#Hey, I'm working on monster pathfinding

1 messages · Page 1 of 1 (latest)

viscid pebble
#

@ocean tulip

#

okay, I will be back in like one hour and I will try your suggestions

viscid pebble
#

I can't find better equation for jump height

ocean tulip
#

Think of it in terms of the discrete timestep simulation that happens

#

each frame the object moves by its velocity and its velocity is also reduced by gravity

#

so it's like:

float vel = rb.velocity.y;
float accelerationPerFrame = gravity * Time.fixedDeltaTime;

// the number of frames before it reaches the apex
int numberOfFrames = Mathf.CeilToInt(vel / accelerationPerFrame);

float currentVelocity = vel;
float totalHeight = 0;
for (int i = 0; i < numberOfFrames; i++) {
  totalHeight += currentVelocity * Time.fixedDeltaTime;
  currentVelocity -= accelerationPerFrame;
}

// this is how high it will get!
return totalHeight;```
#

there might be a way to do it without the for loop

#

but I'm not sure

#

Natural numbers 1 to 100 is a set of first 100 natural numbers, where 100 is the largest natural number and 1 is the smallest one. Learn how to find the sum of natural numbers from 1 to 100 using concepts, formula,s and examples.