I’ve been wanting to develop “flattened” flight system for an NPC, where it only appears to “fly” on the X and Z axis without any physics being able to apply to it on the Y axis, so that is appears to move around like a hockey puck in mid-air. Is there any effective, preferably physics engine-based, way to do this? I previously used VectorForce, where I calculated the cumulative mass of the relevant NPC model and used that to calculate a counterforce against the game’s gravity using a force conversion function that I had developed earlier. It “works” after also explicity changing its y-position to what I desire, but, because it effectively makes the object have complete antigravity, it can “bump up/down” on the y axis when it hits things because there are no constraints there. I considered the plane constraint, but I am not sure how to use it properly, if it even does that job. Thank you very much in advance for you help on this matter!
It sounds like the PlaneConstraint is what you need.
I haven’t used it before, but when I’ve been trying out new Constraints I’ve always read up on each of the properties and then experimented with the different settings and values to see what each does.
Thanks. I’ve tried it and used it before, but I seem to only be able to confine it to one axis at a time instead of two. But I’ll keep trying and let you know if I find something!
Okay, so I found a “decent” solution. If you setup the LinearVelocity constraint, you can be explicit in only allowing the most extreme constraint forces to occur, by axis, on the y axis and have no constraining forces on the x or z axis. In addition, you set the velocity itself, in vector mode, to 0, 0, 0. That way, any y-axis velocity/movement is constrained to 0, but, since there are no forces acting on the X or Z axis with LinearVelocity, you can push it or use any other external forces to move it however you see fit on the X and Z axis.
I say decent, though, because I am not sure that it is the most efficient approach. In addition, I’ve noticed that the object can still “slightly” bump up or down if you hit it hard enough with your character, which means that the constraint forces are not fully effective.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.