PDA

View Full Version : Skydiving Alice - response to proximity of an object


Kelrizzo
04-29-2013, 03:49 PM
Ok, got another one I'm working with.

Alice has taken up skydiving and leaps from the helo and drifts toward the carrier.

What I want to do is if she is within 1 meter of the top of the deck, she lands safely.

More or less than that, she flies off from wherever she is into the water.

The controls are simply. Space bar starts the animation, left, right, and down arrows to control descent; enter to land.

Currently she always flies into the water. I'm sure it's something wrong with my boolean collideWithCarrier function. It's not accurately picking up when she is within a 1 meter proximity of the top of the carrier. I tried to work around this by first checking for Alice's relation to the top of the carrier, then checking the Carrier's relation to Alice. Maybe this is because we are actually not dealing with Alice's height, but her bottom-most point?

I've attached the code as it stands so far.

sfunk
04-29-2013, 04:13 PM
Haven't looked at the game. but to check an objects orientation or center point. just rotate the object and check to see where it revolves around. and Alice bases collision off of the objects midpoint. so take that into consideration

Kelrizzo
04-29-2013, 04:28 PM
Thanks Sfunk.

I was taking that into consideration by trying a couple different things: skydivers (height) *2 + carriers (height) * 2 for example. I've tried to set the proximity so it would be anywhere between carrier center point and 3 meters off the deck, just for testing purposes (at least that's what I was trying to accomplish :D ), but all to no avail. I simply fly up and backwards denoting failure, each time.

sfunk
04-29-2013, 05:49 PM
Here is an example world of how I would accomplish this.

-I used "when world begin events" and right clicked to change it to what you see in my example, this allows for a begin,during and end of the world, which if you place a method in the during part of this, the world constantly checks this method.

-Placing the collision method I made into the during section of the event allowed for it to be checked constantly making it more accurate, plus the way I did the collision made it a little more accurate but not a hundred percent, but still better.

-If you right click the event "when a key is typed and change it to when a key is pressed, you can place your movement method into the during section of that event to make a more fluid motion of moving.

hope it helps