Jump to content

Questions about GetPos


irswat

Recommended Posts

What exactly does this return? Is based on a grid system with player as (0,0,0) and 128 units=6 ft?

I need to find out if a NPC ref's (x,y,z) is under a giant mechs foot. I have the coordinates all mapped out for the range of the area(z,y,z) would be under both the right, and left foot.

 

From ground to knee the mech is 128 units.

The width of each foot is 53.25 units

the depth of each foot is 71 units

the width of the mech is 140 units.

Assuming (0,0,0) is the mechs center, with its feet on the ground, and the return value of GetPos is measured in units relative to the player, I can calculate if another NPC is right under my foot. If true I can play squishy sound and killactor.

Does GetPos use a grid system with the center of the 4096x4096 as 0,0? Say I want to know the position of a reference relative to player position. (e.g. how far is the reference to the left of the player, or in front of the player, or to the right of the player, etc) How can I do this?

There is this script, but I am unsure how it works really. Could someone explain it to me.

float fAngle
float fRelativePos

Begin GameMode

	set fRelativePos to player.GetPos z + <Z OFFSET>
	myREF.setPos z fRelativePos

	set fAngle to player.GetAngle Z + <ANGLE OFFSET>
	myREF.SetAngle Z fAngle

	set fRelativePos to player.GetPos Y + <PLAYER OFFSET> * cos fAngle
	myREF.SetPos Y fRelativePos

	set fRelativePos to player.GetPos X + <PLAYER OFFSET> * sin fAngle
	myREF.SetPos X fRelativePos

End



Edited by irswat
Link to comment
Share on other sites

As per the wiki: "GetPos: Gets the position of the calling object relative to the world on the specified axis (X, Y, or Z)."

 

This all steps into trig, which is not something I'm great at. If you want a formula that calculates the distance to an object in 2D relation to the player, look at my radar mod.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...