Jump to content

Child entities won't move


TheKkubas
 Share

Recommended Posts

Hi! When I used Entity:Move child entities of model wont work. 3D model is moving but Leadwerks stuff like pivots, cameras etc. won't move. I discovered it on that script:

Script.object = "" --entity "Starship"
Script.pivot = "" --entity "CameraPos"
Script.uppoint = "" --entity "FowardPivot"
Script.backpoint = "" --entity "BackPivot"
Script.camera = "" --entity "Camera"
function Script:Start()

end

function Script:UpdateWorld()
objectrot = Vec3()
if window:KeyDown(Key.W) then

self.object:Move(self.uppoint:GetPosition())
end


if window:KeyDown(Key.A) then
local oldrotation = Vec3()
local newrotation = Vec3()
oldrotation = self.object:GetRotation()
newrotation = oldrotation+Vec3(0,0,0.7)
self.object:SetRotation(newrotation)
objectrot = newrotation

end

if window:KeyDown(Key.D) then
local oldrotation = Vec3()
local newrotation = Vec3()
oldrotation = self.object:GetRotation()
newrotation = oldrotation+Vec3(0,0,-0.7)
self.object:SetRotation(newrotation)
objectrot = newrotation

end
end

The

Script.uppoint = "" --entity "FowardPivot"

is a child of

Script.object = "" --entity "Starship"

. When i try to move with "W" pivot should go with spaceship but it won't.

Link to comment
Share on other sites

This is a very strange line of code:

self.object:Move(self.uppoint:GetPosition())

 

If the child's position happens to be 0,0,0, no movement will occur. In any case I think the Move command does not work the way you are picturing:

http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitymove-r165

My job is to make tools you love, with the features you want, and performance you can't live without.

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...