Hello, I come to disturb you again about CollisionPusher
This my situation
- I create the car beside the building
- I move(drive) the car toward that building
- when crashing, the building push back the car automatically
because my car is added to CollisionPusher
The question is, how can I get the position after the car is pushed back?
Note that, I position the car through the nodePath function using:
car.setPos(x, y, z)
and if I cannot check when the car hit the building, so the object will still stay move forward and cause the errors.
Thank you for any answers of my old questions and this question.
I believe you’re looking for
This will return a Point3D or a Vec3, I can’t remember which.
pos = car.getPos()
I usually manipulate position of vehicles by simply advancing in the Y direction of the model’s space. So you wouldn’t actually need to know the current position in global space.
I typically have movement in a task and measusre “dt” as time between frames. Remember from physics that distance = velocity X time. Thus:
This code advances the car in its y-axis direction at a constant speed regardless of framerate.
It returns neither, but a normal Point3, which is a normal floating-point position. Point3D is double (correct me if I’m wrong)
This looks a bit complicated and ugly, use this instead:
car.setY(car, dt*self.speed )