AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Entity Circular Translation Movement (https://forums.alliedmods.net/showthread.php?t=335497)

XSlayer 12-09-2021 23:06

Entity Circular Translation Movement
 
Hi i wanted to make an entity travel around an origin, i have origin 1(center) and origin2(start), and i have start velocity, but i dont know how to make the circle direction,

https://i.ibb.co/hLj877r/rad.png

Natsheh 12-10-2021 03:13

Re: Entity Circular Translation Movement
 
I would form it like the following...


In entity think

Isnt Entity In radius?
NewOrigin = Origin One + Entity Left/Right Vector
MoveToNewOrigin

Else

RotatePointByAngle
MoveToOrigin


Here is the function RotatePointByAngle

You just need to rephrase the code to pawn language.
PHP Code:

POINT rotate_point(float cx,float cy,float angle,POINT p)
{
  
float s sin(angle);
  
float c cos(angle);

  
// translate point back to origin:
  
p.-= cx;
  
p.-= cy;

  
// rotate point
  
float xnew p.p.s;
  
float ynew p.p.c;

  
// translate point back:
  
p.xnew cx;
  
p.ynew cy;
  return 
p;




All times are GMT -4. The time now is 11:29.

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