Jump to content

How to make spinning object collide with the avatar?


Shard Soyinka
 Share

You are about to reply to a thread that has been inactive for 432 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am working on creating an "obstacle course" but I am having some issues: I want some spinning obstacles that avatars have to jump over as they run along a beam or else the obstacle knocks the avatar off the beam. Unfortunately, the obstacle objects pass right through the avatar as if the obstacles were phantom, yet they still seam to be physically present in their default location so you suddenly run into an invisible object at the obstacles home position. Making the moving obstacles physical objects just causes them to fly all over the place. Any suggestions?

Link to comment
Share on other sites

5 hours ago, Wulfie Reanimator said:

llSetKeyFramedMotion

IIRC KFM moved objects can still be knocked off-course by avatars (among other physical actors).

You could try making it physical, setting gravity to 0, llMoveToTarget its current position, and llSetStatus lock its rotation in the axes it's not spinning.

Link to comment
Share on other sites

31 minutes ago, Love Zhaoying said:

My first thought was, making it physical is a requirement.

Yeah, the taxonomy of physicality in SL is weird and doesn't translate to english very well. "physical" objects can be pass-through able and not-physical objects stop physical things (unless those physical things are pass-through able)!

Turns out you also need a fairly significant mass to push avatars:

default
{   state_entry()
    {   llSetStatus(STATUS_PHYSICS,FALSE);
        llSetPhysicsMaterial(DENSITY|GRAVITY_MULTIPLIER,0,0,0,10000.0);
        llSetScale(<3,0.2,1.0>);
        llSetStatus(STATUS_ROTATE_X|STATUS_ROTATE_Y,FALSE);
        llSetStatus(STATUS_PHYSICS|STATUS_ROTATE_Z|STATUS_BLOCK_GRAB,TRUE);
        llMoveToTarget(llGetPos(),0.2);
        llTargetOmega(<0,0,1>,1.0,1.0);
    }
}

 

Edited by Quistess Alpha
  • Like 2
Link to comment
Share on other sites

46 minutes ago, Quistess Alpha said:

IIRC KFM moved objects can still be knocked off-course by avatars (among other physical actors).

Some conflicting verbiage in the documentation...

Quote

Collisions with physical objects will be computed and reported, but the keyframed object will be unaffected by those collisions. (The physical object will be affected, however.)

...

Collisions with avatars affect the angular movement of the object and it may not reach the final rotation.

I'm not able to get inworld and test, but I wonder if any effects on angular movement would matter for an object that is playing a looped KFM to just spin in place forever?

Edited by Fenix Eldritch
  • Like 1
Link to comment
Share on other sites

The "physics" terms for SL are:

  • Physical - actively affected by gravity, forces/wind, and collisions from other objects
  • Nonphysical - static, solid objects which physical objects cannot pass through (and don't interact with other nonphysical objects)
  • Phantom - static, solid objects which physical objects can pass through (ghosts, essentially)
Edited by Wulfie Reanimator
  • Like 1
Link to comment
Share on other sites

1 minute ago, Wulfie Reanimator said:

Phantom - static, solid objects which physical objects can pass through (ghosts, essentially)

Not static if they're also physical. (which is rare and often a mistake, but a completely valid state of being)

  • Like 2
Link to comment
Share on other sites

16 minutes ago, Fenix Eldritch said:

I'm not able to get inworld and test, but I wonder if any effects on angular movement would matter for an object that is playing a looped KFM to just spin in place forever?

Doesn't seem significant at least:

default
{   state_entry()
    {   llSetScale(<3.0,0.25,1.0>);
        // force new prim equivalency system:
        llSetLinkPrimitiveParams(LINK_THIS,[PRIM_PHYSICS_SHAPE_TYPE,PRIM_PHYSICS_SHAPE_CONVEX]);
        // previous times I've tried this, rotating twice by 180 degrees led to bad results.
        rotation z90 = llAxisAngle2Rot(<0,0,1>,PI_BY_TWO);
        llSetKeyframedMotion(
        [ z90,2,  z90,2,  z90,2,  z90,2
        ],
        [KFM_MODE, KFM_LOOP, KFM_DATA, KFM_ROTATION]);
    }
}

 

Link to comment
Share on other sites

34 minutes ago, Wulfie Reanimator said:

The "physics" terms for SL are:

  • Physical - actively affected by gravity, forces/wind, and collisions from other objects
  • Nonphysical - static, solid objects which physical objects cannot pass through (and don't interact with other nonphysical objects)
  • Phantom - static, solid objects which physical objects can pass through (ghosts, essentially)

So if I understand correctly, as long as it is not "phantom", then spinning the object around will result in collision detection.  

But, would a non-physical object actually be able to "move"/"push" the avatar?  I "read this requirement into" the original question all by myself, the OP probably wasn't asking this.

Sorry if I missed the answer in one of the earlier replies.

 

Link to comment
Share on other sites

6 minutes ago, Love Zhaoying said:

But, would a non-physical object actually be able to "move"/"push" the avatar?  I "read this requirement into" the original question all by myself, the OP probably wasn't asking this.

Yes, if a physical object (an avatar) and a non-physical object (a 'spinning thing') occupy the same space, the physical thing gets 'pushed' away. the trick/problem is the non-physical thing has to not 'move through' the avatar. if for example a thing "spins" by setting its rotation +20 degrees every 0.2 seconds, for a sufficiently far away avatar, the object could push it forward for 0.2 seconds, then push it backwards for 0.2 seconds, effectively 'passing through' because it was "moving" too fast with not enough resolution. 

  • Like 1
Link to comment
Share on other sites

10 minutes ago, Love Zhaoying said:

But, would a non-physical object actually be able to "move"/"push" the avatar?  I "read this requirement into" the original question all by myself, the OP probably wasn't asking this.

 

A non-physics object that is moved inside an avatar (or a physics object) will result in the avatar from getting ejected from it, but if I had to guess that won't result in as "realistic" collision since there's no actual momentum, just a sudden overlap of hitboxes.

  • Like 1
Link to comment
Share on other sites

21 minutes ago, Love Zhaoying said:

So if I understand correctly, as long as it is not "phantom", then spinning the object around will result in collision detection.  

But, would a non-physical object actually be able to "move"/"push" the avatar?  I "read this requirement into" the original question all by myself, the OP probably wasn't asking this.

Sorry if I missed the answer in one of the earlier replies.

https://i.kym-cdn.com/entries/icons/original/000/028/596/dsmGaKWMeHXe9QuJtq_ys30PNfTGnMsRuHuo_MUzGCg.jpg

There are two kinds of motion in SL; server-side (affects the world, observable by scripts) and client-side (seen only in the viewer, just an illusion).

llTargetOmega creates client-side rotation in nonphysical objects. Your viewer is making the object look like it's spinning, but scripts and collisions behave as if it's not moving at all, which is what OP noticed. (The spinning is also not synchronized with other viewers. Each viewer can see the object pointing in a different direction, even if the rate of spin is the same. It works just like avatar animations, which are also only played client-side.)

This is useful because the spinning takes no resources from the server/sim, while appearing very smooth to any observer even at high framerates.

And yes, non-physical objects can push avatars, though only because an avatar (a physical object) can't exist inside any solid object. The physics system will force any physical object out of other objects.

Edited by Wulfie Reanimator
  • Thanks 1
Link to comment
Share on other sites

13 minutes ago, Wulfie Reanimator said:

llTargetOmega creates client-side rotation in nonphysical objects. Your viewer is making the object look like it's spinning, but scripts and collisions behave as if it's not moving at all, which is what OP noticed. (The spinning is also not synchronized with other viewers. Each viewer can see the object pointing in a different direction, even if the rate of spin is the same. It works just like avatar animations, which are also only played client-side.)

Completely expected and what I understood to be true. I did not assume the OP was using llTargetOmega.

Link to comment
Share on other sites

6 hours ago, Quistess Alpha said:

Yeah, the taxonomy of physicality in SL is weird and doesn't translate to english very well. "physical" objects can be pass-through able and not-physical objects stop physical things (unless those physical things are pass-through able)!

Turns out you also need a fairly significant mass to push avatars:

default
{   state_entry()
    {   llSetStatus(STATUS_PHYSICS,FALSE);
        llSetPhysicsMaterial(DENSITY|GRAVITY_MULTIPLIER,0,0,0,10000.0);
        llSetScale(<3,0.2,1.0>);
        llSetStatus(STATUS_ROTATE_X|STATUS_ROTATE_Y,FALSE);
        llSetStatus(STATUS_PHYSICS|STATUS_ROTATE_Z|STATUS_BLOCK_GRAB,TRUE);
        llMoveToTarget(llGetPos(),0.2);
        llTargetOmega(<0,0,1>,1.0,1.0);
    }
}

 

I am getting a little lost on figuring this out, especially when I have a prim rotated on its side and the angles I am rotating around seam to change.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 432 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...