Decided to try this function for the 1st time. I have a model I thought I’d press a key and have them go up and down (basically, a jump). The code below makes them go up but they never come back down.
Obviously, I['m missing something very simple:
Now it’s mad because you’re passing a Point3 for endZ. That’s not right. If you specify endZ, it should be a single float. If you want to pass a Point3 as the target, that’s what endPos is for.
But note that you’re not computing the target pos correctly anyway. When you say this:
end = start
you are not assigning end to a copy of start. You are actually assigning end to the same object as start. This means that when you reassign end in the next line, you are also changing start at the same time! Instead of that assignment, you should do:
end = Point3(start)
which does make a copy. Or, since all you’re changing is the Z component, just forget about that, and pass endZ = start.getZ() + RPG_FLY_HEIGHT.
That’s probably what you have in mind anyway. Note that you also can’t specify both endPos and startVel. The set of things that you’re allowed to pass is all described in the API Reference for the ProjectileInterval constructor.
StandardError: projectile never reaches plane Z=100.0
So something’s run with my startVel?
I’ve tried (1,1,1), (0,0,1), and (0,0,-1).
The manual doesn’t give much guidance on it other than to say that’s it’s a Point3. (it also says that for endZ). Sorry for all the questions, I’m a bit slower than usual on this one.
The standard units for ProjectileInterval is feet and seconds. The acceleration due to gravity is 32 feet per second squared.
If you launch your projectile with a velocity of (1, 1, 1) or (0, 0, 1), then you are specifying an upward velocity of 1 foot per second. If you specify a velocity of (0, 0, -1), then you are specifying a downward velocity of 1 foot per second.
I don’t know where it’s starting from, but if it’s starting from z = 0 (for instance), you’re going to have to throw it a lot faster than 1 foot per second if you expect it to get all the way up to z = 100.
How fast do you need to throw a ball to reach the roof? Pretty fast. If you just toss it up lightly, it’s going to go a couple of feet up and then fall back down, and never come close to the roof.
That’s what the error message is telling you. You didn’t throw it upwards fast enough to ever reach z = 100.