Two years after I started this thread I have found the answer! LOL!
Pseudo code:
-First, calculate the acceleration (as a vector) you would normally apply to the vehicle.
-Copy the current velocity vector of the vehicle into a temp variable
-Add the acceleration vector you would normally apply to the temp velocity vector
-If the length (magnitude) of the velocity vector with the added acceleration is greater than the max speed (a scalar), set the length of the temp velocity vector to the max speed
-subtract the current velocity vector of the vehicle from the temp velocity vector that we just limited
-that difference is the acceleration you want to apply to the vehicle.
In this way you can limit the velocity of a vehicle without directly touching the velocity variable and by just apply acceleration to it. This is useful if you want to limit a vehicle's speed and still want explosions and collisions to send it flying all over the place.
- Game Maker Community
- → Viewing Profile: Posts: Tiby312
Tiby312
Member Since 29 Mar 2005Offline Last Active Private
Community Stats
- Group New Member
- Active Posts 406
- Profile Views 2403
- Member Title GMC Member
- Age 23 years old
- Birthday August 30, 1989
-
Gender
Male
-
Location
Philippines
1
none
Latest Visitors
Posts I've Made
In Topic: Speed Of Object In Specific Direction
30 January 2011 - 08:30 PM
In Topic: Font To Sprite Script
27 January 2011 - 01:07 PM
Updated to work in GM8
In Topic: AI Movement
09 September 2010 - 09:09 PM
I don't think it's that simple. I don't think you can to compare the boats speed to the distance to the target unless it were going straight at it (which is hardly ever, most of the time the tanks direction will be different from the direction to the target). I mean, the boat could be going fast enough to stop directly at the point, but it might be going in the wrong direction.
Here is a .gmk (game maker 8) of the problem and what I have tried so far.
Download
via box.net
Here is a .gmk (game maker 8) of the problem and what I have tried so far.
Download
via box.net
In Topic: Tracking Down Songs In Resource Pack 2
10 February 2010 - 10:54 PM
I found this song that sounds like Firehawk. I dont know if it helps.
http://www.youtube.c...h?v=eZ0AxZKKjjI
http://www.youtube.c...h?v=eZ0AxZKKjjI
In Topic: Movement Compensation - It Must Be Solved
04 January 2010 - 02:23 AM
Ooo yes that appears to work. I made a quick example:
Download
via box.net
But getting it to predict bounces is trickier than I thought.
I thought that if I could get that point (point B below), all I had to do was reflect it like in this diagram:

But this doesn't work because because you have to shoot further ahead of the target if it's moving away, than if it bounces toward you. It's not symmetrical. I fail.
Download
via box.net
But getting it to predict bounces is trickier than I thought.
I thought that if I could get that point (point B below), all I had to do was reflect it like in this diagram:

But this doesn't work because because you have to shoot further ahead of the target if it's moving away, than if it bounces toward you. It's not symmetrical. I fail.
- Game Maker Community
- → Viewing Profile: Posts: Tiby312
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content