Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
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
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
langasam im pan winkel drehen #265375
05/12/09 11:31
05/12/09 11:31
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Online OP
Expert
alibaba  Online OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
hab ma eine einfache frage:
wie kann ich einen objekt weich zum player drehen lassen??


how can i rotate an entity smoothly to the player.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: langasam im pan winkel drehen [Re: alibaba] #265378
05/12/09 11:48
05/12/09 11:48
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
function turn_towards_target()
{
// get the direction from the entity MY to the entity YOU
vec_set(temp,your.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp); // now MY looks at YOU
}

from manual.


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: langasam im pan winkel drehen [Re: alibaba] #265380
05/12/09 11:56
05/12/09 11:56
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Das obige rotiert die Entity ziemlich abrupt, er wollte ja weich drehen.
Probier das mal:

function rotate_entity(var rotate_angle,var rotate_speed)
{
if(my.pan == rotate_angle) return;
result = ang(rotate_angle - my.pan);
if(result > 0) my.pan += rotate_speed * time_step;
if(result < 0) my.pan -= rotate_speed * time_step;
if(ang(rotate_angle - my.pan) < 0 && result > 0) my.pan = rotate_angle;
if(ang(rotate_angle - my.pan) > 0 && result < 0) my.pan = rotate_angle;
}

Ruf die so in der Action deiner Entity auf(im Loop):

...
VECTOR temp;
var temppan;
vec_set(temp.x,player.x);
vec_sub(temp.x,my.x);
vec_to_angle(temppan,temp.x);
rotate_entity(temppan,30);
...

Müsste klappen; Syntaxfehler vorbehalten, die Funktion rotate_entity ist original im Kingdom Hearts Movement Tutorial von David Lancaster zu finden.

Last edited by the_clown; 05/12/09 11:57.
Re: langasam im pan winkel drehen [Re: the_clown] #265406
05/12/09 13:18
05/12/09 13:18
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Online OP
Expert
alibaba  Online OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
vielen dank:) hat sehr geholfen:D


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: langasam im pan winkel drehen [Re: alibaba] #265430
05/12/09 14:40
05/12/09 14:40
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Bitte.


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