User Tools

Site Tools


4rpl:commands:getobjfacinganglecell

Index

GetObjFacingAngleCell

GetObjFacingAngleCell(<-UID “ObjName” <-posX <-posZ) ->angle

Description

Returns the angle in degrees between the obj's forward (the z direction) and the specified world position. The X,Z coordinates are a position in 3D world space. An obj is facing a position when the forward (z direction) of the obj it pointing directly at the position. This function ignores the y position of the obj. This function works using world coordinates. The resulting angle is in degrees.

Examples

GetObjFacingAngleCell(self "Barrel" 42 1)
#--Aiming at target:
RotateObjTowardsCell(self "AXLE" <-targetPos.x <-targetPos.z <-AXLE_ROT_SPEED)
if(GetObjFacingAngleCell(self "AXLE" <-targetPos.x <-targetPos.z) lt(0.5))
	RotateObjTowards(self "TURRET" <-targetPos<-TURRET_ROT_SPEED)
	if(GetObjFacingAngle(self "TURRET" <-targetPos) lt(0.5))
		@fire
	endif
endif

Index

4rpl/commands/getobjfacinganglecell.txt · Last modified: 2024/02/18 15:11 by Vertu