Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,454 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 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 | 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