|
evil Pulley object will Not rotate!
#347494
11/15/10 17:22
11/15/10 17:22
|
Joined: Feb 2008
Posts: 27 kentucky
SpearBang
OP
Newbie
|
OP
Newbie
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
Senior Expert
|
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:
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.
|
|
|
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
Expert
|
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)
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
|
|
|
|