Hi again,
I would like to know what would be the simplest solution to apply a motor to an object without the need of a constraint? Let say I want a physic entity to have a motor that make it spin over some of its axis, but freely in the world. I am asking this because I see that motor seems to be usable only via the constraint architecture. Has anyone done this before?
Thx.
Verbo
How to use motors without any constraint
-
- Posts: 50
- Joined: Thu Jul 09, 2009 1:46 pm
Re: How to use motors without any constraint
I'm not sure if this is what you're out for, but wouldn't it be more simple to apply a certain amount of impulse on the object every frame? If you only want rotation, this can be achieved by using btRigidBody::applyTorque.
Cheers,
Simon
Cheers,
Simon
-
- Posts: 39
- Joined: Fri May 08, 2009 9:27 pm
Re: How to use motors without any constraint
Hi,
Thanks for the answer. I thought about using applyTorque, but I want to expose to the user the "motor feature" I was talking about. So I thought that just applying torque would not allow for an intuitive control on the desired angular rate for the body. It`s just that I saw a similar feature in another physic solution which is not open source, the one from Virtools(they use an old version of havok). You could set a spring motor on an object and set the angular rate, the max power, the max torque and the axis.
Any ideas?
Verbo
Thanks for the answer. I thought about using applyTorque, but I want to expose to the user the "motor feature" I was talking about. So I thought that just applying torque would not allow for an intuitive control on the desired angular rate for the body. It`s just that I saw a similar feature in another physic solution which is not open source, the one from Virtools(they use an old version of havok). You could set a spring motor on an object and set the angular rate, the max power, the max torque and the axis.
Any ideas?
Verbo
-
- Posts: 50
- Joined: Thu Jul 09, 2009 1:46 pm
Re: How to use motors without any constraint
Verbo,
Looking into the source code for the constraints I discover that the code is strictly implemented in the different constraints. I would suggest an attempt to extract that code into your own interface. All constraints implement their own version of the motors, and the code does not seem too complex. There are different booleans for each that determine wether or not the motor is enabled.
I hope this helps,
Simon
Looking into the source code for the constraints I discover that the code is strictly implemented in the different constraints. I would suggest an attempt to extract that code into your own interface. All constraints implement their own version of the motors, and the code does not seem too complex. There are different booleans for each that determine wether or not the motor is enabled.
I hope this helps,
Simon
-
- Posts: 39
- Joined: Fri May 08, 2009 9:27 pm
Re: How to use motors without any constraint
Hi,
Thanks for the advice. Indeed, that`s a solution I was somehow lending toward I guess.
I think I could indeed take what I need in the appropriate constraint code and apply the motor torque outside from the constraint solver, using the data from the motors, something like that. Could be a good trade off.
I will give it a shot eventually, I will let you know guys if it works, just to share the experience
See ya!
Verbo
Thanks for the advice. Indeed, that`s a solution I was somehow lending toward I guess.
I think I could indeed take what I need in the appropriate constraint code and apply the motor torque outside from the constraint solver, using the data from the motors, something like that. Could be a good trade off.
I will give it a shot eventually, I will let you know guys if it works, just to share the experience
See ya!
Verbo