How to find the direction of moving object??
hey guys i want to find the direction of movement of one object… plz help me… I know only three functions getX ,getY, getZ.
getH() and getP():
Note that the ‘direction’ depends on how the model was created in the modeller.
I dont know what you want to do exactly, but this might be helpful for you as well:
.lookAt(nodepath) will make your node ‘face’, ‘look at’ another one
There are a number of convenient solutions for common things you might want to do. Here are a few more tips…
To get nodepath’s local +Y as a vector in world (render) coordinates:
v = render.getRelativeVector(nodepath, Vec3.forward())
To simply move nodepath along local Y axis by a float distance:
nodepath.setY(nodepath, distance)
If you use setFluidPos you can get a “delta” vector indicating the difference between nodepath’s current position and the previous frame:
v = nodepath.getPosDelta()
While in the subject…
And if I want to move a scaled NodePath forward in 50 render units?
dist = np.getRelativeVector(render, Vec3(0,50,0)).length()
np.setY(np, dist)
The best way is do something like that?
thanxxx guysss…
My task is to fire a bullet in the direction of Panda. my panda is walking… bt my bullet goes not in the direction where Panda is looking… my code for movement of bullet is like this…
self.sphereMovement = self.sphereAxis.hprInterval(10.0,Point3(posy,0,0),startHpr=Point3(0,0,0))
plzz help.