Jump to content


Photo

3D Racing Enemy rotation


  • Please log in to reply
7 replies to this topic

#1 _225929

_225929

    GMC Member

  • New Member
  • 13 posts
  • Version:GM8

Posted 01 September 2011 - 09:33 PM

I have a promblem with this .I know how to rotate my player but I don't know how to rotate the enemy. I don't know if I am doing it right but for the racing i use path. And I want to change the rotation of the enemy car. I am using also third person camera.
  • 0

#2 Buff-Robotix

Buff-Robotix

    Who Took My Pants!?!

  • GMC Member
  • 309 posts

Posted 02 September 2011 - 01:49 AM

Hi!
Ok, do you want your enemy car to face forward on the path?
If you want the car to face the next point in the path, this may be difficult. but you could try:
direction=point_direction(path_get_x(path_positionprevious),path_get_y(path_positionprevious),path_get_x(path_position),path_get_y(path_position));
This will set the direction to forward on the path.
also I believe this is a 2D question.

RobotiX

Edited by Buff-Robotix, 02 September 2011 - 01:51 AM.

  • 0

#3 _225929

_225929

    GMC Member

  • New Member
  • 13 posts
  • Version:GM8

Posted 02 September 2011 - 02:34 PM

Hi!
Ok, do you want your enemy car to face forward on the path?
If you want the car to face the next point in the path, this may be difficult. but you could try:

direction=point_direction(path_get_x(path_positionprevious),path_get_y(path_positionprevious),path_get_x(path_position),path_get_y(path_position));
This will set the direction to forward on the path.
also I believe this is a 2D question.

RobotiX

thx but doesn't work.
  • 0

#4 TheSnidr

TheSnidr

    That guy

  • Global Moderators
  • 2435 posts
  • Version:GM:Studio

Posted 02 September 2011 - 03:40 PM

To rotate it in the moving direction, use this transformation:
d3d_transform_set_rotation_z(direction)
If you're using other transformations as well, use add instead of set
  • 0

#5 _225929

_225929

    GMC Member

  • New Member
  • 13 posts
  • Version:GM8

Posted 02 September 2011 - 10:12 PM

To rotate it in the moving direction, use this transformation:

d3d_transform_set_rotation_z(direction)
If you're using other transformations as well, use add instead of set

what do you mean? Because I am using this transformation for my character
  • 0

#6 Buff-Robotix

Buff-Robotix

    Who Took My Pants!?!

  • GMC Member
  • 309 posts

Posted 23 September 2011 - 07:11 AM

use d3d_transform_add_rotation_z(direction)
  • 0

#7 Gamebastard

Gamebastard

    GMC Member

  • New Member
  • 31 posts

Posted 09 October 2011 - 11:02 PM

make sure after you do the rotations and draw the model make sure you write d3d_transform_set_identity. This makes it only sets the rotation to models before this point. exactly like this:
d3d_transform_add_translation(0-x,0-y,0-z);
d3d_transform_add_rotation_z(direction);
d3d_transform_add_translation(x,y,z);

d3d_model_draw(myModel,x,y,z,-1);

d3d_transform_set_identity();
that should work fine.
  • 0

#8 donjon

donjon

    GMC Member

  • New Member
  • 6 posts

Posted 10 October 2011 - 10:38 AM

To rotate it in the moving direction, use this transformation:

d3d_transform_set_rotation_z(direction)
If you're using other transformations as well, use add instead of set


I 100% agree with u this is rite way for me
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users