Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
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
3 registered members (TedMar, AndrewAMD, fairtrader), 578 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
Drifting and Aiming problems #201530
04/09/08 19:11
04/09/08 19:11
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
I have two problems. I'll start with the easiest. I have a normal FPS with a player that accelerates when you press w and deaccelerates when you let go. Simple except the player 'drifts' after you release the key.
This is the code I'm using to deaccelerate:

if(my.relx > 0.2)
// where my.relx is the relative movement value in the x direction
{
my.relx -= 0.5;
}
if(my.relx < -0.2)
{
my.relx += 0.5;
}

you would expect the player to atleast drift backwards, but this is not so, it continues to drift forwards. I have tried adapting all the values but it doesn't see to have any affect, whats more this 'drift' seems to happen randomly, sometimes it stops as needed, others it keeps going slowly in the same dirrection with a value of a round 0.15, positive.

Also my other problem is a turning one. In my game I have oppponents that, if they sense you, will spin to face you. Originally I simply set the enemies 'pan' value to the dirrection needed to face the player but this is jerky and unnatural so i used a piece of code that finds the difference between the dirrection the entity should be facing and the current pan values, it then rotated the entity by this value so that as it get close to its mark is slows down forming a more natural action, however dispite trying this only lets the entity rotate one way and even worse sometimes it does multiple spins before reaching its target.

Any suggestions ot these problems?

Thanks!


For some reason, my ambition always seems to beat my ability.
Re: Drifting and Aiming problems [Re: sydan] #201536
04/09/08 19:32
04/09/08 19:32

M
Malice
Unregistered
Malice
Unregistered
M



 Code:
if(key_w)
{
my.force_x=1;
}
if(key_s)
{
my.force_x=-1;
}
if(!key_s && !key_w)
{
my.force_x=0;
}
my.relx+=my.force_x*(a_speed)*time_step; 
if(my.force_x ==0)
{
if(my.relx <0)
{
my.realx+=0.5*time_step;
}
if(my.relx >0)
{
my.realx-=0.5*time_step;
}
}



something like this is what I use for cars.. You can play with it.
Malice

Last edited by Malice; 04/09/08 19:34.
Re: Drifting and Aiming problems [Re: ] #201540
04/09/08 19:36
04/09/08 19:36
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
And your cars don't keep on moving afterwards? Okay I'll try that. Thanks.
I wish I could help you with some of the problems ive seen you posting, but Im not really experience in those short of areas.


For some reason, my ambition always seems to beat my ability.

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