Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
4 registered members (AndrewAMD, TipmyPip, NewbieZorro, Grant), 14,196 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
evil Pulley object will Not rotate! #347494
11/15/10 17:22
11/15/10 17:22
Joined: Feb 2008
Posts: 27
kentucky
S
SpearBang Offline OP
Newbie
SpearBang  Offline OP
Newbie
S

Joined: Feb 2008
Posts: 27
kentucky
hello all What I have is an object of a pulley that needs to follow the car, and spin on its roll axis but follow the car. what I did is this

///////////////////////////////////////////////////////////////
action PulleyFollow()
{
you = pChassis;
while(1)
{
var temp;
temp +=1;

vec_set(my.pan,pChassis.pan);
vec_set(my.tilt,pChassis.tilt);
vec_set(my.roll,temp);
vec_set(my.x,vector(-85,-3,-17)); // set Pulley model about the entity center
vec_for_ent(my.x,you); // convert the position to world coordinates
vec_to_ent(my.roll,you);
wait(1);
}

}
////////////////////////////////////////////////
if i dont use the vec_set(my.roll,temp); the pulley will follow in the right place but no spin. I am new to coding so i am sure i am going around my elbow to find my foot. Can any one please help!

Last edited by SpearBang; 11/15/10 17:24.
Re: evil Pulley object will Not rotate! [Re: SpearBang] #347505
11/15/10 18:27
11/15/10 18:27
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
If I got you right (if you need model to chase an other model and turn on its roll), then you are doing wrong...
Here is what I can offer:
Code:
action follower()
{
    VECTOR temp;
    while(1)
    {
          vec_set(temp.x,player.x); // turn to player
	  vec_sub(temp.x,my.x);
          vec_to_angle(my.pan,temp);
          my.roll += 10 * time_step; // play with 10
          wait(1);
    }
}

This will turn model to player and will turn its ROLL as well.
All you need now, is adapt this to your needs (ENTITY* pChassis etc) and move it with C_MOVE instruction.
If you'll need help PM me. Enjoy.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: evil Pulley object will Not rotate! [Re: SpearBang] #347507
11/15/10 18:31
11/15/10 18:31
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Try replacing your 3 lines
vec_set(my.pan,pChassis.pan);
vec_set(my.tilt,pChassis.tilt);
vec_set(my.roll,temp);

with this one line
vec_set(my.pan, vector(pChassis.pan,pChassis.tilt,temp));
And let us know how it goes...

Otherwise try this(untested)
Code:
action PulleyFollow()
{
   you = pChassis;
   var temp = 0;
   while(1)
   { 
      temp += 1;

      vec_set(my.pan, vector(pChassis.pan, pChassis.tilt, temp));

      vec_set(my.x, vector(-85,-3,-17));  //set position offset from UN_TURNED chassis
      vec_rotate(my.x, pChassis.pan);     //rotate by chassis angle
      vec_add(my.x, pChassis.x);          //position AT chassis

      wait(1);
   }
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: evil Pulley object will Not rotate! [Re: EvilSOB] #347578
11/16/10 16:16
11/16/10 16:16
Joined: Feb 2008
Posts: 27
kentucky
S
SpearBang Offline OP
Newbie
SpearBang  Offline OP
Newbie
S

Joined: Feb 2008
Posts: 27
kentucky
Thank you evilsob not only did you fix the code you taught me a little something thank you for you time bro.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1