Yue Posted June 13, 2018 Share Posted June 13, 2018 Script.Yue = nil --entity "Malla Jugador" Script.Pivote = nil --entity "Pivote" unction Script:PostRender(context) context:SetBlendMode(Blend.Alpha) context:SetColor(1,0,0,1) context:DrawText(self.Pivote:GetRotation().z,2,2) --No Update Position X, y or Z. context:SetBlendMode(Blend.Solid) context:SetColor(1,1,1,1) context:DrawStats(2,22) end I want to retrieve the rotation angles of another entity to update another entity with that data. But it doesn't work for me, any suggestions? Quote Link to comment Share on other sites More sharing options...
Defranco Posted June 13, 2018 Share Posted June 13, 2018 It would be self.Pivote:GetPosition() for position and (self.Pivote:GetRotation().x.0) (example) for rotations there is also GetAngle() in the documentation but I've never used this one 1 Quote Link to comment Share on other sites More sharing options...
Yue Posted June 13, 2018 Author Share Posted June 13, 2018 Ok, thanks, I've corrected, however neither GetPosition, nor GetRotation, updates their new rotation angle, nor their new position. I don't know what I still have to do. 1 Quote Link to comment Share on other sites More sharing options...
havenphillip Posted June 13, 2018 Share Posted June 13, 2018 What are you trying to do? Get another entity's position written on the screen? 1 Quote Link to comment Share on other sites More sharing options...
Yue Posted June 13, 2018 Author Share Posted June 13, 2018 I have the character controller, a small cube in the center of the character controller and a weighing inside the character controller. The camera is daughter of the small cube, and the small cube turns according to the movement of the mouse, what I want is to rotate the character and the character controller according to the Y angle in which the cube turns, but I can't get it to work. The goal is that when you press the W key, according to the angle of the cube or the camera, the character controller changes its angle in the direction of the camera or the cube. But I can't get it to work. Translated with www.DeepL.com/Translator Quote Link to comment Share on other sites More sharing options...
Yue Posted June 13, 2018 Author Share Posted June 13, 2018 Well, the evidence indicates that if I create a separate cube, and try to recover its rotational or positional coordinates if it works, it seems that the problem is that those elements are related to each other and that's why I can't recover that data. Quote Link to comment Share on other sites More sharing options...
havenphillip Posted June 13, 2018 Share Posted June 13, 2018 So the camera moves with the cube as you move the cube but the character doesn't move? 1 Quote Link to comment Share on other sites More sharing options...
Solution havenphillip Posted June 13, 2018 Solution Share Posted June 13, 2018 Something like this maybe on the cube? I had to child the cube to the player. The numbers work and it follows the player but I don't know if it's what you're trying to do exactly you might have to mess with it. Script.Yue = nil --entity "Malla Jugador" Script.Pivote = nil --entity "Pivote" function Script:PostRender(context) self.pos = self.entity:GetPosition(true) DrawX = self.pos.x context:SetBlendMode(Blend.Alpha) context:SetColor(1,0,0,1) context:DrawText(""..Math:Round(DrawX), 2, 2) context:SetBlendMode(Blend.Solid) context:SetColor(1,1,1,1) context:DrawStats(2,22) end Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.