I am trying to move a block on a curve with reference to 2 points on the curve.I am facing problem when one point is on horizontal part of curve and other point is at an angle.How do i place the block at angle.Please help.
Thanks in advance
The first derivative of a curve is the slope or tangent in a point of a curve, the function/method GetFirstDerivative returns a vector3D with Dx,Dy,Dz components , if your curve is planar, there is no need for Dz, so the tangent=Dy/Dx then theta=math.atan2(Dy,Dx), another method is to calculate the angle from X axis to the derivative vector. GetFirstDerivative should be a method for every object that inherits from the curve class. Try the docs on this topic.
When you said "move block along...", did you mean you want user to drag a selected block/entity and when the mouse cursor is dragged, the block/entity moves along a given curve?
If so, one of my articles may be of help:
Thanks for the reply.Yes im moving block along a curve but im moving it with respect to 2 points.Im finding it difficult to get the direction.How do i get in which direction should i move.Any ideas??
Access a broad range of knowledge to help get the most out of your products and services.