Hi,
when using "public BodyRigid nodename" the editor does not show the property field.
ComponentClass supports Node and Unigine.Component and not Physics-Related Classes.
Is there code to validate the node type?
Or to get direct feedback in the editor if the selected .node is not acceptable?
This is my current code, it works and keeps the program from crashing on Init. General help and advise is always welcome.
public Node bouncing_node;
private BodyRigid bouncing_body;
private void Init()
{
if(bouncing_node)
{
if(bouncing_node.NumChildren > 0)
{
var child = bouncing_node.GetChild(0);
if(child.ObjectBodyRigid)
{
bouncing_body = bouncing_node.GetChild(0).ObjectBodyRigid;
}
}
}
}
private void UpdatePhysics()
{
if(bounce_triggerd)
{
bounce_triggerd = false;
if (bouncing_body)
{
bouncing_body.AddForce(vec3.UP * bounce_power);
}
}
}