Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Newbie Questions
by AndrewAMD. 12/04/23 11:14
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (TipmyPip, izorro), 556 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
vec_rotate problem #75646
05/26/06 21:07
05/26/06 21:07
Joined: May 2005
Posts: 819
U.S.
Why_Do_I_Die Offline OP
Warned
Why_Do_I_Die  Offline OP
Warned

Joined: May 2005
Posts: 819
U.S.
This is a pretty noob question , I want to rotate a model around another model using vec rotate , but i cant seem to get the instruction to do anything , here is the code i have for a cube model . the code is straight from the manual , though when i run the level the cube does absolutely nothing , anyone know what i'm missing ?

entity* cube;
var direction[3] = 90, 50, 50;
var angle[3] = 90, 45, 0;
action rotate_cube
{
wait(1);
cube=my;
while(1)
{
vec_rotate(my.pan,angle);
wait(1);
}
}

Re: vec_rotate problem [Re: Why_Do_I_Die] #75647
05/26/06 23:25
05/26/06 23:25
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
yeah.... um... Thats actually not it at all... You need to state exactly how you want it to work. You want one entity to "orbit" around another model?


xXxGuitar511
- Programmer
Re: vec_rotate problem [Re: xXxGuitar511] #75648
05/29/06 04:22
05/29/06 04:22
Joined: Sep 2003
Posts: 281
Arkansas\USA
raiden Offline
Member
raiden  Offline
Member

Joined: Sep 2003
Posts: 281
Arkansas\USA
I think your looking for something like this.
Code:

entity* cube;

action rotateCube {
cube = me;
}

action baseCube {
while(cube == null) { wait(1); }
var counter;
while(1) {
vec_set(temp,vector(-100,0,0));
vec_rotate(temp,counter);
vec_add(temp,my.x);
vec_set(cube.x,temp);
counter += 3 * time;
wait(1);
}
}


or......
Code:

action baseCube {
while(cube == null) { wait(1); }
var counter;
while(1) {
cube.x = my.x + sin(counter) * -100;
cube.y = my.y + cos(counter) * -100;
cube.z = my.z;
counter += 3 * time;
wait(1);
}
}



Attach rotateCube to the entity you want to circle around baseCube.

Have fun

-raiden


"It doesn't matter if we win or lose, it's how we make the game."
--------------------
Links: 3DGS for Dummies
Re: vec_rotate problem [Re: raiden] #75649
05/29/06 04:33
05/29/06 04:33
Joined: May 2005
Posts: 819
U.S.
Why_Do_I_Die Offline OP
Warned
Why_Do_I_Die  Offline OP
Warned

Joined: May 2005
Posts: 819
U.S.
Koo , thnx raiden , will give the code a try , i'm a noob coder so a lot of times i get stuck trying to implement code i've never used before.

Re: vec_rotate problem [Re: Why_Do_I_Die] #75650
05/29/06 05:58
05/29/06 05:58
Joined: Sep 2003
Posts: 281
Arkansas\USA
raiden Offline
Member
raiden  Offline
Member

Joined: Sep 2003
Posts: 281
Arkansas\USA
Your welcome, if you have any problems getting it to work, just let me know.

-raiden


"It doesn't matter if we win or lose, it's how we make the game."
--------------------
Links: 3DGS for Dummies

Gamestudio download | chip programmers | 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