Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,758 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Sliding effect when turning? #150050
08/24/07 17:18
08/24/07 17:18
Joined: Sep 2006
Posts: 36
Tempe, AZ
B
bpc31 Offline OP
Newbie
bpc31  Offline OP
Newbie
B

Joined: Sep 2006
Posts: 36
Tempe, AZ
Hello,

Using c_move I want my boat to pan/rotate when turning but only move to that new angle after a slight delay (continues straight for a few frames), creating a sliding effect like you would see when a car attempts to turn too fast or on a slippery surface.

Thanks!
-Bruce

Re: Sliding effect when turning? [Re: bpc31] #150051
08/24/07 17:53
08/24/07 17:53
Joined: Jul 2002
Posts: 2,002
Europe
ShoreVietam Offline
Expert
ShoreVietam  Offline
Expert

Joined: Jul 2002
Posts: 2,002
Europe
That's really easy if you're already using acceleration and the rel_dist part of ent_move.

Since you rotate the model you rotate the movement direction with the model by using rel_dist.

To avoid this, just rotate your speed vector in the oppsing direction that the character turns to let the movement direction stay the same even if the character turns.

How to do this?


This is your acceleration vector where you store your current speed:
MY._speed_x/y/z

Now you'Re doing somthing like this:
MY.PAN += MOUSE_FORCE.X * 5 * TIME; (for example)

Turn it into this:
TEMP = MOUSE_FORCE.X * 5 * TIME;

MY.PAN += TEMP;
VEC_ROTATE(MY._speed_x, vector(-TEMP, 0, 0)); // Rotates the speed vector into the opposiong direction

VEC_SET(TEMP.X, MY._speed_x);
VEC_SCALE(TEMP.X, TIME); // Time correction
ent_move(TEMP.X, NULLVECTOR);


Done!


My project Schlacht um Kyoto - Das Samurai Browsergame! (sorry, german only)
Re: Sliding effect when turning? [Re: ShoreVietam] #150052
10/08/07 22:40
10/08/07 22:40
Joined: Sep 2006
Posts: 36
Tempe, AZ
B
bpc31 Offline OP
Newbie
bpc31  Offline OP
Newbie
B

Joined: Sep 2006
Posts: 36
Tempe, AZ
Thanks for the help. This was my modified implementation. It's not quite correct yet. See anything wrong?

//DEBUGGING SLIDE
if (key_cul == on)
{
my.skill3 = time * player_speed.pan + max (1 - time * 0.3, 0) * my.skill3;
temp = my.skill3 * time;
my.pan += temp;
vec_rotate(player_speed.x, vector(-temp,0,0));
vec_set(temp.x, player_speed.x);
vec_scale(temp.x, time);
ent_move(temp.x, nullvector);
}


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