AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Let an entity move to the Left/Right (https://forums.alliedmods.net/showthread.php?t=45691)

Ramono 10-09-2006 09:16

Let an entity move to the Left/Right
 
How to let an entity move to the left/right according to it angles.

velocity_by_aim can only be used for forward and backwards.

Thanks,
Ramon.

Emp` 10-09-2006 09:18

Re: Let an entity move to the Left/Right
 
here is something i use. not sure if it's the best way to do it.
Code:

                                                new Float:velocity[3]
                                                VelocityByAim(id, 20, velocity)
                                                beams = 2
                                                f_sorigin[0][0] = origin[id][0] + velocity[0]
                                                f_sorigin[0][1] = origin[id][1] - velocity[1]
                                                f_sorigin[0][2] = origin[id][2] + 12.0
                                                f_sorigin[1][0] = origin[id][0] + velocity[1]
                                                f_sorigin[1][1] = origin[id][1] - velocity[0]
                                                f_sorigin[1][2] = origin[id][2] + 12.0


Ramono 10-10-2006 06:22

Re: Let an entity move to the Left/Right
 
Quote:

Originally Posted by Emp` (Post 389160)
here is something i use. not sure if it's the best way to do it.
Code:

                                                new Float:velocity[3]
                                                VelocityByAim(id, 20, velocity)
                                                beams = 2
                                                f_sorigin[0][0] = origin[id][0] + velocity[0]
                                                f_sorigin[0][1] = origin[id][1] - velocity[1]
                                                f_sorigin[0][2] = origin[id][2] + 12.0
                                                f_sorigin[1][0] = origin[id][0] + velocity[1]
                                                f_sorigin[1][1] = origin[id][1] - velocity[0]
                                                f_sorigin[1][2] = origin[id][2] + 12.0


That code is not complete ?

Any one else?

Emp` 10-10-2006 21:29

Re: Let an entity move to the Left/Right
 
ok... i took the time to make you two functions...
Code:

VelocityToLeft(id, speed, Float:velocity[3])
{
        new Float:aim_velocity[3]
        VelocityByAim(id, speed, aim_velocity)
        velocity[0] = aim_velocity[1]
        velocity[1] = aim_velocity[0]*-1
        velocity[2] = aim_velocity[2]
        return velocity
}
VelocityToRight(id, speed, Float:velocity[3])
{
        new Float:aim_velocity[3]
        VelocityByAim(id, speed, aim_velocity)
        velocity[0] = aim_velocity[1]*-1
        velocity[1] = aim_velocity[0]
        velocity[2] = aim_velocity[2]
        return velocity
}

edit: after revising it, here are my final results

Ramono 10-11-2006 10:25

Re: Let an entity move to the Left/Right
 
Thanks,

Edit: when u look up it goes very weird, it just goes up and not sidewards..


All times are GMT -4. The time now is 04:53.

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