Jump to content

spring arm functionality


photo

Recommended Posts

Posted

Does UNIGINE has something similar to UE4's spring arm functionality?

Posted (edited)

This is just a camera attached to something with kind of logic?

Shouldnt be that hard to reproduce.

But, yes, sometimes some 'ready-mades' would come in handy. ;) (like for none programmers like me)

 

Edited by werner.poetzelberger
  • 7 months later...
Posted

Here's a way I managed a spring arm in C#.

[ShowInEditor]
Node camera, springStart, springEnd;

private void Update()
{
    var from = springStart.WorldPosition;
    var to = springEnd.WorldPosition;
    WorldIntersection raycast = new WorldIntersection();
    World.GetIntersection(from, to, 1, raycast);
    if(raycast.Surface < 0){
        camera.Position = springEnd.Position;
    }
    else{
        camera.WorldPosition = raycast.Point;
    }
}

 

×
×
  • Create New...