A little help with math usage in coordinates, I think.

Post » Tue Sep 02, 2014 5:45 pm

I'm trying to create a "bridge" between players ground level position, and the position of an area that is higher than the player's position, if that makes any sense.

The procedure is very doable, the problem is manipulating the X coordinates. Later I tried manipulating the Y coordinates to see if there will be any difference, and the veering off was still the same.

SetAngle was a necessity to flatten out the platforms as otherwise, they were appearing at odd angles.

Instead of the new platform appearing "in front" of the previously created platform, it instead begins veering off to the right. This trend continues with subsequent platforms added. I'm thinking I need that

Math.cos, Math.sin stuff but I don't understand it(or even what kind of math that is).

Here's my code(also open to suggestions because this uses a lot of latent functions. Couldn't think of a way around it).

Spoiler
Event OnLoad(); Welcome to the worlds longest OnLoad Event.Float PosX = PlayerRef.GetPositionX()Float PosY = PlayerRef.GetPositionY()Float PosZ = PlayerRef.GetPositionZ()Float SelfPosX = GetPositionX()Float SelfPosY = GetPositionY()Float SelfPosZ = GetPositionZ()Float AngleY = PlayerRef.GetAngleY()Float AngleZ = PlayerRef.GetAngleZ()Float GetPlayerDistance = self.GetDistance(PlayerRef)Float GetPlayerHeight = PlayerRef.GetHeight()ObjectReference PlacePlatform = PlayerRef.PlaceAtMe(TNPlatformACTI,1,false,false)ObjectReference PlacePlatformAtSelf = self.PlaceAtMe(TNPlatformACTI,1,false,false)ObjectReference PlaceSecondPlatForm = PlayerRef.PlaceAtMe(TNPlatformACTI,1,false,false)ObjectReference PlaceSecondPlatFormAtSelf = self.PlaceAtMe(TNPlatformACTI,1,false,false)PlayerRef.RemoveSpell(TNPlatformSpell); To allow the marker to run its course and then delete itself. Prevents spamming.; DisablePlayerControls(true,true,true,false,true,true,true,false); Freeze the player so that the coordinates are static.    if GetPlayerDistance <= MinDist    ;   self.Disable()    ;    Utility.wait(0.5)    ;    self.Delete()    else        PlacePlatformAtSelf.SetAngle(0, AngleY, AngleZ)        PlacePlatformAtSelf.SetPosition(SelfPosX + 50, SelfPosY, SelfPosZ - 50)        PlaceSecondPlatFormAtSelf.SetAngle(0, AngleY, AngleZ)        PlaceSecondPlatformAtSelf.SetPosition(SelfPosX + 100, SelfPosY, SelfPosZ - 100)        wait(0.5)        PlacePlatform.SetAngle(0, PlayerRef.GetAngleY(), PlayerRef.GetAngleZ())        PlaceSecondPlatForm.SetAngle(0, AngleY, AngleZ())        PlaceSecondPlatForm.SetPosition(PosX + 50, PosY, PosZ + 50)        PlayerRef.AddSpell(TNPlatformSpell)    ;   EnablePlayerControls()    ;    self.Disable()    ;    wait(0.5)    ;    self.Delete()    endifEndEvent
User avatar
Donald Richards
 
Posts: 3378
Joined: Sat Jun 30, 2007 3:59 am

Return to V - Skyrim