Skip to content

Categories:

The Swing Scene

No, no, not that swing scene – doors. Swinging doors. They’re pretty simple, but they serve to illustrate a point about how scripted geometry works.

RavenPrim Swing Door

Here’s what we want: A door that swings open in steps, from 0 to 90 degrees. Using the RavenPrim, it’s easy to do, but not as simple as it looks.

Rotate It!

The first and most obvious thing we might try is rotating the prim 90 degrees.

TouchedState = Rotate;<0,0,90>

RavenPrim Door Overhead NoMove Annotated

Rotation happens around the center of the prim, so rather than the door swinging back on it’s hinge, as we might hope, it rotates in place.

Move It!

In order to get the hinging affect, we need to move the center back and to the side as well.

TouchedState = Rotate;<0,0,90>|Move;<-0.625,0.625,0>

RavenPrim Door Overhead Move Annotated

One thing worth noting is how far to move the RavenPrim. This depends on the size and thickness of the door. The move sideways and back should be half the width of the door, minus half it’s thickness.

moveDistance = (width/2) – (thickness/2)

The prim is 1.5m wide and .25m thick, so the amount to move is: .75 – .125, thus .625

Go Phantom

Ever try to walk through an open door and bump into it? Ow. Let’s not do that. Set the prim phantom and the klutzy and lagged can walk right through while it’s open.

TouchedState = Rotate;<0,0,90>|Move;<-0.625,0.625,0>|Phantom;True

Transition Gradually!

In order to get the door to swing open, rather than snap open, specify how many intermediate steps you want it to take.

TransitionSlices = 5

Hope that helps you out with your adventures in doorland. We’ll cover further enhancements to doors shortly.

Posted in Uncategorized.