Jump to content

Recovering data from another entity does not work


Yue
 Share

Go to solution Solved by havenphillip,

Recommended Posts

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?

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

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

 

 

229304761_Sinttulo.thumb.png.e410195fb62573cab46fc0b5a400c5e2.png

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

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.

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

  • Solution

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...