Jump to content


Photo

How do I make a 3D Crazy Taxi Arrow?


  • Please log in to reply
1 reply to this topic

#1 Dimidoosie

Dimidoosie

    GMC Member

  • GMC Member
  • 64 posts
  • Version:GM7

Posted 25 February 2012 - 05:50 PM

To followup with my very noobish "How to make a 3D car" topic, I would like to know how to make a red 3D arrow that turns to face a targeted object (NOT ON THE Z AXIS PLEASE), and slowly turns green as it approaches the object. I would also like to know how to make it bigger when it approaches (not too big though) and smaller (but not too small) as it gets farther away.

Again, I need a very good, thorough explanation that explains everything necessary to get the arrow working.

I will handle the drawing of the arrow. It will be a seperate object. I will place it above the car, and place the "step towards point" action in its step event to make it follow the car at all times. If this is not the best method of having the arrow follow the car, or if you know how to make it fuly functional as PART of the car object, please explain how.

No links to examples or Extension packages. All I want from those who are willing to help isfor them to guide me through the steps. DO NOT post unless you have information I can use right away.

Edited by Dimidoosie, 25 February 2012 - 09:09 PM.

  • 0

#2 Rexhunter99

Rexhunter99

    GMC Member

  • GMC Member
  • 922 posts

Posted 25 February 2012 - 10:16 PM

To followup with my very noobish "How to make a 3D car" topic, I would like to know how to make a red 3D arrow that turns to face a targeted object (NOT ON THE Z AXIS PLEASE), and slowly turns green as it approaches the object. I would also like to know how to make it bigger when it approaches (not too big though) and smaller (but not too small) as it gets farther away.

Again, I need a very good, thorough explanation that explains everything necessary to get the arrow working.

I will handle the drawing of the arrow. It will be a seperate object. I will place it above the car, and place the "step towards point" action in its step event to make it follow the car at all times. If this is not the best method of having the arrow follow the car, or if you know how to make it fuly functional as PART of the car object, please explain how.

No links to examples or Extension packages. All I want from those who are willing to help isfor them to guide me through the steps. DO NOT post unless you have information I can use right away.

As a follow up to the other topic and what i posted there, this is all fairly trivial up to the point you say:

(NOT ON THE Z AXIS PLEASE)

So how is the arrow meant to point at the object if it is always facing the same direction on the Z axes.

Again, all doable with d3d_transform_* functions all you need to do is set your limits for size of the arrow, code to get a ratio:
var start_dist,cur_dist;
start_dist = 300; // This is the distance from when you first needed to find that location
cur_dist = distance_to_point( object.x, object.y ); // This is the current distance from the objective (object)
size = 0.5 + ( 1.0 * ( start_dist / cur_dist ) ); // The size of the arrow on a scale of 50% the original arrow size to 150% the size.
If you need the arrow to get smaller as you get closer, that's simple too, start the size value at 1.5 not 0.5 and subtract the equation from 1.5 not add, this is trivial arithmetic that should be asked in the novice section, not the advanced 3D Techniques section.

A similar equation can be used for the colour, in fact if I remember correctly there is a function for that specific effect, let me look. Yes the function is merge_color()
cur_color = merge_color( c_white, c_green, ( start_dist / cur_dist ) );

There, can't possibly any more simple than that, and most of that information I could find in the game maker manual.
as long as cur_dist does not reach 0, those equations will work (and I assume you will have the car stop in an ambiguous radii away from the actual objective so again, should work fine. If you feel that is unsafe for your needs you can add a new line under the spot we get the distance from the objective to the car at the current point in time:
if ( cur_dist >= -0.001 && cur_dist <= 0.001 ) cur_dist = 0.1;
This will make sure that cur_distance won't be zero, or will be as close as possible, but if it gets too close will default to 0.1 (which is so close that a user won't really notice it, especially in a Crazy Taxi style environment (which are large)

Anyway, you are still being rude and demanding of us, we are here to help you fix your problems when you can't get something to work right, and to teach you from those mistakes, not to give you code for your use, that's for you to make.

Edited by James_ogden, 25 February 2012 - 10:18 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users