AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Move entity problem (https://forums.alliedmods.net/showthread.php?t=253184)

RateX 12-17-2014 06:49

Move entity problem
 
Hi,
I'm currently using this stock by CHW_Chronic to move entity from point to point:
PHP Code:

stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speedFloat:new_velocity[3])
{
    
new_velocity[0] = (origin2[0] - origin1[0])
    
new_velocity[1] = (origin2[1] - origin1[1])
    
new_velocity[2] = (origin2[2] - origin1[2])
    new 
Float:num floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
    
new_velocity[0] *= num
    new_velocity
[1] *= num
    new_velocity
[2] *= num

    
return 1;


However, when I increase the speed, the entity start to fly off track. What's wrong with it?

RateX 12-19-2014 12:55

Re: Move entity problem
 
1 Attachment(s)
I discovered that at around 60m/s or higher, the entity start to fly off track. Anyone good at maths can solve the problem?

--EDITED--
I attached below the test result and the plugin I use to test this.
http://i.imgur.com/RSZLEa3.png


All times are GMT -4. The time now is 15:19.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.