Gamestudio Links
Zorro Links
Newest Posts
Zorro version 3.0 prerelease!
by Grant. 02/24/26 22:21
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 5,796 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
very simple question #389444
12/14/11 13:35
12/14/11 13:35
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Hey, I've made door, and everything works pretty well. Door turns about it's PAN (via c_rotate) for 80 degrees, but only in one direction (clockwise). What I want to add is, to make door always rotate away from player, I guess this should be easy as hell, but I can't get it..


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: very simple question [Re: 3run] #389448
12/14/11 14:25
12/14/11 14:25
Joined: Sep 2007
Posts: 101
Luxembourg
K
krial057 Offline
Member
krial057  Offline
Member
K

Joined: Sep 2007
Posts: 101
Luxembourg
Not sure if this is the best way, but something like this should work:

Php Code:
//when a key is pressed and player is near the door:
ANGLE angTmp;
ang_diff(angTmp, player.pan,door.pan);
vec_normalize(angTmp,1);

//repeat this until rotation finished
c_rotate(door,vector(angTmp.pan,0,0),0); 




regards Alain

Last edited by krial057; 12/14/11 14:26.
Re: very simple question [Re: krial057] #389449
12/14/11 15:12
12/14/11 15:12
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Hey 3run,

just c_trace in each direction and when you hit the player, move in the other direction!

Re: very simple question [Re: PadMalcom] #389450
12/14/11 15:15
12/14/11 15:15
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
PadMalcome, I thought about that, but won't that be slow??


Alain, thank you for you sugestion, I'm going to give it a try.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: very simple question [Re: 3run] #389465
12/14/11 17:47
12/14/11 17:47
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Let's assume your door model has its hinges in the origin (in MED) and is parallel to the x-Axis. Then you can simply write

vec_set(temp,player.x);
vec_to_ent(temp,my);
turn_direction = -sign(temp.y);

while(...)
my.pan += 5*turn_direction*time_step;
wait(1);
}


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: very simple question [Re: Superku] #389469
12/14/11 18:04
12/14/11 18:04
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Just made door with two traces, works fast. Will try your approuche.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung

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