|
I'm still working on my rigidbody character, trying to figure out the best type of force mode to use while moving it. I basically want my character to move at a constant 10mph, allowing for outside things to act on him. A force blowing him backward at 5mph will bring him to a total speed of 5mph. But how would I keep such a constant speed? I've tried all manners of AddForce(desiredVelocity,ForceMode.Force), using mass, time, and such. When I try to make a capped speed to reach, it manages to reach it no matter what forces are acting against it. I also haven't been able to figure a way around the "floaty physics" of my own gravity forces. Anybody have a definitive solution to this?
(comments are locked)
|
|
You need to keep the character from exerting more force than they're capable of - calculate how much force you need to get to 10mph, and if that's more than the character can exert, just add their maximum exertion instead of how much they calculated that they need. Or, whenever a force is applied to the character (e.g. froma wind zone), tell the character that its base velocity is no longer 0,0,0, but is instead that force. That's what I'm trying to do. Assuming my character could instantly accelerate to his maximum force to bring him to 10mph, what function would I use to apply that? After I find that out, I'll manually apply acceleration to where he can accelerate to said force.
Oct 07 '10 at 05:48 PM
Tuah
I think you want Vector3.Min( desiredForce, maximumForce )
Oct 07 '10 at 06:37 PM
Loius
Would I apply that with AddForce(force,ForceMode.Force)? force*mass*Time.deltaTime,ForceMode.Force, or even force*mass,ForceMode.Impulse?
Oct 07 '10 at 06:41 PM
Tuah
OH! I figured out my problem. I had Mass set to 150!
Oct 07 '10 at 08:45 PM
Tuah
Edit: Just realized I'm back where I started. I'm going to try something else...
Oct 07 '10 at 09:14 PM
Tuah
(comments are locked)
|
