Two quick questions about UserData and Custom Controls

UserData: Is UserData inherited by child Spatial? In other words if I put {“key”:”passable”,”value”:”true”} on a node and I collide with its Geometry and check its UserData for “passable” would I get “true”?

A yes or no to this question would be fine in the event that the answer is no I would just step up through the parent Nodes and look for the UserData Key “passable”.

Custom Controls: I would like to create a custom player control that doesn’t use Bullet. There are two things that the control is doing one is casting a ray down from the player’s centre the other is checking collisions of a custom bounding object.

Question 1: How would you find the root Node and why would you do it that way? “I need to find the root node to check collisions for both”

Question 2: How would you move the player smoothly through the world? “I am moving x check collisions, moving y check collisions, then finally moving z and again checking collisions the result is what I want but just looking for a better way”

Sorry in advance if either of these topics have been covered in the forms here.

  1. No, its specific to a spatial in the hierarchy
    2a) application.getRootNode() gives you the rootNode :wink: I’d probably pass it to the control like “setPickingSpatial” or something like that. Otherwise you can just go spatial.getParent() until you get no parent anymore, then that should be the root node
    2b) You move the spatial a bit each frame, basically directionVectorspeedtpf until you reach the destination point. Pretty much the way it is shown in the tutorials.
1 Like

Thanks @normen you’re always quick to reply. What tutorial are you referring to?

I must have missed them I need to work on my searching skills obviously
:google:

Either press “F1” in the SDK or click the “Docs” link on the left of this page.