Tell me more ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

I'm trying to make a character jump on a landing pad who stays above him. Here is the formula I've used (everything is pretty much self-explainable, maybe except character_MaxForce that is the total force the character can jump ):

deltaPosition = target - character_position;
sqrtTerm = Sqrt(2*-gravity.y * deltaPosition.y + MaxYVelocity* character_MaxForce);
time = (MaxYVelocity-sqrtTerm) /gravity.y;
speedSq = jumpVelocity.x* jumpVelocity.x + jumpVelocity.z *jumpVelocity.z;

if speedSq < (character_MaxForce * character_MaxForce) we have the right time so we can store the value

jumpVelocity.x = deltaPosition.x / time;
jumpVelocity.z = deltaPosition.z / time;

otherwise we try the other solution

time = (MaxYVelocity+sqrtTerm) /gravity.y; 

and then store it

jumpVelocity.x = deltaPosition.x / time;
jumpVelocity.z = deltaPosition.z / time;
jumpVelocity.y = MaxYVelocity;

character_velocity = jumpVelocity;

The problem is that the character is jumping away from the landing pad or sometime he jumps too far never hitting the landing pad.

share|improve this question
1  
Hi Pasquale, and welcome to Physics Stack Exchange! This is a site for conceptual questions about physics, not general homework help. If you can edit your question to ask about the specific physics concept that is giving you trouble, I'll be happy to reopen it. See our FAQ and homework policy for more information. – David Zaslavsky Sep 24 '12 at 23:07
Hi David I will try but I'm not a physicist So I don't know if I will be able to be more generic :D – Pasquale Sada Sep 25 '12 at 9:20
You don't have to be a physicist to ask a question here, but we do expect that you show some work to narrow your original question down to the specific issue that is giving you trouble. – David Zaslavsky Sep 25 '12 at 16:40
1  
Or, try this: suppose I tell you, in answer to the current version of your question, "find the instructions in your textbook and follow them." What would you respond? If your answer would be that you can't find the instructions, then your question isn't going to be appropriate here. If you do find something useful in the book but there is a particular part of it that you're confused about, then you should ask about that. – David Zaslavsky Sep 25 '12 at 18:54
1  
You're still not asking a conceptual question, though. All you've done in this latest revision is add some pseudocode which shows what you're doing, but you're still not asking anything more specific than "what's wrong?" – David Zaslavsky Sep 26 '12 at 21:50
show 9 more comments

closed as too localized by David Zaslavsky Sep 24 '12 at 23:07

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.