YouGroove Posted February 12, 2015 Share Posted February 12, 2015 Hi, I have a character with child pivots, i call : self.entity:AlignToVector(...) But the child objects don't get rotated or aligned. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Josh Posted February 12, 2015 Share Posted February 12, 2015 The children won't necessarily be aligned, they will just follow the orientation of the parent. This example works as expected: function App:Start() --Create a window self.window = Window:Create() self.context = Context:Create(self.window) self.world = World:Create() local camera = Camera:Create() camera:Move(0,0,-6) local light = DirectionalLight:Create() light:SetRotation(35,35,0) --Create a model self.model = Model:Box() local child = Model:Box() child:SetPosition(2,0,0) child:SetParent(self.model) child:SetColor(1,0,0) return true end function App:Loop() if self.window:Closed() or self.window:KeyHit(Key.Escape) then return false end --Get the vector between the mouse position and the center of the screen local v = self.window:GetMousePosition() local dx = v.x - self.context:GetWidth()/2.0 local dy = self.context:GetHeight()/2.0 - v.y v = Vec3(dx,dy,0):Normalize() --Align the model to the vector self.model:AlignToVector(v,0) Time:Update() self.world:Update() self.world:Render() self.context:Sync() return true end Quote 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 More sharing options...
YouGroove Posted February 12, 2015 Author Share Posted February 12, 2015 I didn't attach the child object by code , instead i just drag and drop the object as child in the scene view. Using Align it don't rotates the child. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
marchingcubes Posted February 22, 2015 Share Posted February 22, 2015 I see this too.. Interestingly, objects dragged in the scene tree to be children in an older build of the editor (Couldn't say which one) work correctly - e.g. I load an old map where a sprite is a 'child' of the camera, and it behaves as expected. In the latest Leadwerks (3.4beta), adding an object as a child of the camera in the Scene tree has no effect on the objects position or orientation, regardless of how the 'parent' camera is moved. Quote Link to comment Share on other sites More sharing options...
marchingcubes Posted February 22, 2015 Share Posted February 22, 2015 More info: it seems, in the editor, these parent/child relationships work as expected - when i move my camera in the editor, my child object moves with it. In-game, the parent/child relationship seems non-existent when the parent object's position is set with SetPosition() Quote Link to comment Share on other sites More sharing options...
awgsknite Posted February 22, 2015 Share Posted February 22, 2015 This bug you found is probably the reason why my parent model from a child does not work either : http://www.leadwerks.com/werkspace/topic/12037-parent-to-center/#entry87418 prefabs appear in all sorts of places on mine as the player moves Quote http://steamcommunity.com/profiles/76561197977392956/7977392956/ Link to comment Share on other sites More sharing options...
awgsknite Posted February 22, 2015 Share Posted February 22, 2015 In the latest Leadwerks (3.4beta), adding an object as a child of the camera in the Scene tree has no effect on the objects position or orientation, regardless of how the 'parent' camera is moved. I also have this happening in my game. From my fpsplayer I added a pivot as a child(drag and drop) that has my gui on it and from it(child) I am calling to another script's function(fpsplayer function) to create a prefab infront of the player. But each time the player moves, the prefab is placed in a different place and never where the setposition was set(directly infront of the fpsplayer) Quote http://steamcommunity.com/profiles/76561197977392956/7977392956/ 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.