luke.errington Posted November 28, 2011 Share Posted November 28, 2011 I know that this should be simple, and I'm obviously missing something, but in a simple example, I can't seem to get the player to be positioned relative to a Node. The player always ends up with world positioning. int init() { Node new_node = new NodeDummy(); Node new_node_2 = engine.world.loadNode("signal.node"); new_node.setWorldPosition(dvec3(0.0, 0.0, 0.0)); new_node_2.setWorldPosition(dvec3(10.0, 0.0, 0.0)); PlayerActor p = new PlayerActor(); p.setParent(new_node_2); p.setPosition(dvec3(0.0, 0.0, 0.0)); p.flushTransform(); engine.game.setPlayer(p); return 1; } The camera should be 'witihin' new_node_2, but is actually at the origin, and I have to move backwards a fair bit to see new_node_2. I can position new_node_2 relative to new_node and that works, but I just can't seem to get the player to be relative. It seems either setParent or setPlayer aren't doing what I am expecting them too ... (I've tried using a common parent Node for these that is already in the world, just as I've tried using local positioning for these rather than world positioning, and a bunch of other stuff too.) Any ideas? Also, the camera appears to be looking along the z axis, with +ve x downwards. Is this expected? When I use PlayerSpectator I get +ve x upwards. Is this also expected? I wasn't sure why there would be a difference. I was expecting the camera to be looking along the x-axis or y-axis ... Thanks. Link to comment
manguste Posted November 30, 2011 Share Posted November 30, 2011 Players cannot have a parent a node as they are designed to move whithout any binding and restrictions. They always use the world coordinates for their transformations. For PlayerActor you can check setViewDirection() function. Also, the camera appears to be looking along the z axis, with +ve x downwards. Is this expected? When I use PlayerSpectator I get +ve x upwards. Is this also expected? I wasn't sure why there would be a difference. Yep, so the current design goes. I will document these differences in camera orientations to avoid confusion. Link to comment
craig.biggs_ Posted December 22, 2011 Share Posted December 22, 2011 Hi, I was trying this out with PlayerDummy and it seems to be OK. Does the "Players cannot have a parent node" apply to PlayerDummy or is this just a coincidence? In the end our Player's dont need the physics etc associated with the other Player classes, we just need to be able to set them as children of other nodes. If they aren't able to be, its no big deal, we'll use NodeDummy instead. Link to comment
ulf.schroeter Posted December 23, 2011 Share Posted December 23, 2011 We used PlayerDummy as child node without any problems so far Link to comment
manguste Posted December 26, 2011 Share Posted December 26, 2011 You are right. PlayerDummy is handled in a simplified way in may aspects and this restriction applies to all players except for PlayerDummy. Link to comment
Recommended Posts