Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 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,365
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,365
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,365
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,365
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,365
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,365
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 | 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