zaira Posted May 3, 2016 Posted May 3, 2016 3 x i : I am a looser in geometry. I want to place two objects (XMarkerHeading) relative to a rectangle (Cage) in my Papyrus script: I have no idea how to calculate the angles and positions What I have is X,Y,Z, AngleX, AngleY, AngleZ, Width, Length and Height of the rectangle
spoonsinger Posted May 3, 2016 Posted May 3, 2016 Triangles based on the centre point of the rectangle to centre point of the objects using weird old BC era Greek technology - also now widely available on wikipedia? IGMC
zaira Posted May 3, 2016 Author Posted May 3, 2016 Triangles based on the centre point of the rectangle to centre point of the objects using weird old BC era Greek technology - also now widely available on wikipedia? IGMC XMarkerHeadings are directed rectangles - I have drawn triangles to show the direction
bjornk Posted May 3, 2016 Posted May 3, 2016 How about this? In pseudo-papyrus... C: Cage G: Green marker O: Orange marker ; Position the green marker right in the middle of the cage: G.SetPos x (C.GetPos x) G.SetPos y (C.GetPos y) G.SetPos z (C.GetPos z) ; Set G's angles identical to C: G.SetAngle x (C.GetPos x) G.SetAngle y (C.GetPos y) G.SetAngle z (C.GetPos z) ; Position the orange marker (C.length is the length of cage): O.SetPos x (C.length + G.GetPos x) O.SetPos y (C.length + G.GetPos y) O.SetPos z (G.GetPos z) ; Set O's angles identical to G, except the z axis: O.SetAngle x (G.GetPos x) O.SetAngle y (G.GetPos y) O.SetAngle z (-G.GetPos z) [or O.SetAngle z (180 + G.GetPos z)]
Guest Posted May 3, 2016 Posted May 3, 2016 Something in real Papyrus: Function translate(ObjectReference toMove, ObjectReference dst, float offset, float rotation) float anglez = dst.GetAngleZ() float anglex = dst.GetAngleX() * -1 float offsetz = offset * math.sin(anglex) float tempfloat = offset * math.cos(anglex) float offsetx = tempfloat * math.sin(anglez) float offsety = tempfloat * math.cos(anglez) float posx = dst.GetPositionX() + offsetx float posy = dst.GetPositionY() + offsety float posz = dst.GetPositionZ() + offsetz toMove.setAngle(dst.getAngleX(), dst.getAngleY(), dst.getAngleZ()+rotation) toMove.TranslateTo(posx, posy, posz, 0, 0, dst.getAngleZ()+rotation, 90.0, 25.0) EndFunction Call it with the ObjectReference to be moved (toMove) and the target one for reference (dst), and use offset as distance, and rotation as angle (in degrees.)
zaira Posted May 3, 2016 Author Posted May 3, 2016 Cage X,Y,Z is not the center - it is a corner of the cage
zaira Posted May 3, 2016 Author Posted May 3, 2016 Now making everything more complicated: Orange is the door Blue is the marker for the NPC who opens the door
Guest Posted May 3, 2016 Posted May 3, 2016 translate(npcMarker, theDoor, 65.0, -45.0) But if the "door" is the yellow sign (and not the orange marker): translate(npcMarker, theDoor, -72.0, 45.0)
zaira Posted May 4, 2016 Author Posted May 4, 2016 TranslateTo won't work for markers - it works only for objects with 3d
zaira Posted May 4, 2016 Author Posted May 4, 2016 Use placeAt, and remove the last two parameters. placeAt? You mean MoveTo? I don't spawn new markers - I'll move existing markers.
Guest Posted May 4, 2016 Posted May 4, 2016 placeAt? You mean MoveTo? I don't spawn new markers - I'll move existing markers. Sorry, you are right. Between different games, I sometimes confuse the functions offered here and there. The correct functions are (to be replaced in my previous code, and you need two, one for the position, one for the rotation): toMove.MoveTo(dst, offsetx, offsety, offsetz) toMove.SetAngle(0.0, 0.0, float dst.getAngleZ()+rotation)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.