Replies: 1 comment
-
I think your solution should work. I also would add such forces directly before the PBD solver starts iterating. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Firstly, thank you for making this amazing library available! I am currently using it to make a simple physics-based game. Is there a built-in way to control an object in real-time, or apply external forces on an object?
I would like the player to be able to control the main character, which is a simple cube rigid body. I haven't yet figured out the best way to do this. The way I have been doing it is to listen to keyboard input, then effectively apply a force on the cube when the player presses a key. In order to apply forces, for now I've added a line to Simulation/TimeStepController.cpp in the TimeStepController::step() function, as such:
This function,
setExternalForceAcceleration()
, fetches the player object, gets its acceleration vector, and adds the new force to the acceleration vector using force/mass. TheForceController
class monitors keyboard input to keep track of the force to be added to make the cube move. But I suspect that there's some feature in the library that I don't know about.Is there a built-in way to control objects in real time, or a built-in way to add external forces to an object, and if not, is there a way you would recommend going about it?
Thank you so much in advance!
Beta Was this translation helpful? Give feedback.
All reactions