Jump to content
Bloodsong Termagant

Mesh Car Front Tires: Omega vs Texture Rotation

Recommended Posts

heyas!

 

okay, so i built a set of front wheels and axle for my mesh car; it's really simple and to 'turn' the wheels i just rotate the whole axle on the z axis left and right.  the y axis is the 'spin' axis.

 

1: TARGET OMEGA:

am i reading this right?  it is impossible to apply a (corrected) target omega rotation to a child prim in a physical object, because the root object keeps rotating and throwing off the child's omega.  ???  i mean, it works fine if the child stays on its original rotation, and the y axis matches the root prim's y axis.  but as soon as i turn the child's y axis, then target omega doesn't know what the dip it is doing.  (despite the fact the wiki SAYS it's local to the child object.)

 

2: TEXTURE ANIMATION:

so not a problem.  the wheels are rounded off cylinders, with a basically square map.  so if i use texture rotation to rotate the texture, it will look as if the wheels are spinning.

except, no.  i apply the texture animation, and the texture rotates about 30 degrees, then pops back to 0 degrees.  over and over again.  why?? 

i went into the texture tab and manually spun it around with the texture rotate dials.  it was fine. 

i'm guessing it's SOMETHING freaky with uvmapping instead of flat squares everywhere like prims, but... what?

 

Share this post


Link to post
Share on other sites

llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES,1,1,0, TWO_PI, 2*TWO_PI);  try this or use the in the prim function llSetTextureAnim

Share this post


Link to post
Share on other sites

Totally OK to use llTargetOmega in its linked form for wheels. Snippet follows.

rotate_wheel( integer which, float speed )
{
    speed *= TWO_PI;
    // llSetLinkTextureAnim( which, ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 1, 1, 1.0, 1.0, speed);
    // for actual 'prim' wheels mod
    // llSetLinkPrimitiveParamsFast( which, [ PRIM_OMEGA, < 0.00, 1.00, 0.00 > * llList2Rot( llGetLinkPrimitiveParams( 1, [ PRIM_ROT_LOCAL ] ), 0 ), speed, 1.00 ] );
    llSetLinkPrimitiveParamsFast( which, [ PRIM_OMEGA, < 0.00, 1.00, 0.00 > * llList2Rot( llGetLinkPrimitiveParams( which, [ PRIM_ROT_LOCAL ] ), 0 ), speed, 1.00 ] );
}

As always its full of my usual over commenting and I upload my wheels in correct easier to move orientation.

YKMV

Why is this forumj so crap at strike through anyway.

Share this post


Link to post
Share on other sites
18 hours ago, Bloodsong Termagant said:

1: TARGET OMEGA:

am i reading this right?  it is impossible to apply a (corrected) target omega rotation to a child prim in a physical object, because the root object keeps rotating and throwing off the child's omega.  ???  i mean, it works fine if the child stays on its original rotation, and the y axis matches the root prim's y axis.  but as soon as i turn the child's y axis, then target omega doesn't know what the dip it is doing.  (despite the fact the wiki SAYS it's local to the child object.)

The rotating (target omega) link is not going to "break" in any way when the root of the object rotates. The wiki page says that the link will rotate around itself, as you should expect from wheels.

There is a different issue though, which is that the rotating object will rotate physically if the root is physical. This means that the rotating wheels will affect the movement of the vehicle unless you set each wheel to have no physics shape (Features tab).

You should also use llSetLinkPrimitiveParamsFast instead, like Mikka Luik showed, so you don't need a script in each wheel.

  • Like 1

Share this post


Link to post
Share on other sites

thanks, guys!

 

of course, beta grid is down today, so i can't test. 

 

haha, i finally got in!  bad news... it's the same stupid as before :( 

i DID notice that i somehow had the front wheels on backwards, but i fixed that, and... well. they spin okay, except when they turn.  you can see here.  its in wireframe so you can see the front wheels through the car.  when they turn, they fishtail instead of spinning on their local y axis.  yes, the axle is the local y axis.

http://recordit.co/ne8bhcrdnV

 

        if(num == DIR_STOP)
        {
           llSetLocalRot(ZeroRot);
          //  llTargetOmega(<0.0, 1.0, 0.0>, 0.0, 1.0);    
          llSetPrimitiveParams( [ PRIM_OMEGA, < 0.00, 1.00, 0.00 > * llGetLocalRot(),  0.0, 1.00 ] );
        }
       
        else if(num == DIR_NORM)
        {
             llSetLocalRot((ZeroRot));
             llSetPrimitiveParams( [ PRIM_OMEGA, < 0.00, 1.00, 0.00 > * llGetLocalRot(), speed*gear, 1.00 ] );
        }
        else if(num == DIR_REV)
        {
             llSetLocalRot((ZeroRot));
             llSetPrimitiveParams( [ PRIM_OMEGA, < 0.00, 1.00, 0.00 > * llGetLocalRot(),  -1*speed*gear, 1.00 ] );
        }
        
        else if(num == DIR_LEFT)
        {llOwnerSay("Turning LEFT");
             llSetLocalRot(LeftRot);
             llSetPrimitiveParams( [ PRIM_OMEGA, < 0.00, 1.00, 0.00 > * llGetLocalRot(), speed*gear, 1.00 ] );
             
        }
        else if(num == DIR_RIGHT) 
        {llOwnerSay("Turning RIGHT");
            llSetLocalRot(RightRot);
            llSetPrimitiveParams( [ PRIM_OMEGA, < 0.00, 1.00, 0.00 > * llGetLocalRot(), speed*gear, 1.00 ] );
            
        }
            

yes, im using it in the front wheels.  both front wheels and axle are all one object.

 

is there any news as to why texture rotate won't work on a mesh object?  or is it just me?  i'm lucky that way...

 

Share this post


Link to post
Share on other sites
On 2/19/2019 at 10:50 AM, Bloodsong Termagant said:

 ... the texture rotates about 30 degrees, then pops back to 0 degrees.  over and over again.  why?? 

Just making sure here: you're rotating it a full 2*PI radians, right? Not just 1.0? (granted, 1.0 radians would be more like 60 degrees than 30, but... it's the best hunch I've got.

I'm somehow not comprehending what the video is showing, but personally I'd try to avoid omega rotation for reasons related to what Wolfie mentions. Even if you set the physics to None, as a physical object it still must be sending a constant stream of object updates to maintain the appearance of rotation, unlike strictly viewer-side non-physical omega or texture animation.

Share this post


Link to post
Share on other sites
11 minutes ago, Qie Niangao said:

Just making sure here: you're rotating it a full 2*PI radians, right? Not just 1.0? (granted, 1.0 radians would be more like 60 degrees than 30, but... it's the best hunch I've got.

I'm somehow not comprehending what the video is showing, but personally I'd try to avoid omega rotation for reasons related to what Wolfie mentions. Even if you set the physics to None, as a physical object it still must be sending a constant stream of object updates to maintain the appearance of rotation, unlike strictly viewer-side non-physical omega or texture animation.

It is more likely as to how the faces of the mesh was set.

Share this post


Link to post
Share on other sites
18 hours ago, Qie Niangao said:

Just making sure here: you're rotating it a full 2*PI radians, right? Not just 1.0? (granted, 1.0 radians would be more like 60 degrees than 30, but... it's the best hunch I've got.

I'm somehow not comprehending what the video is showing, but personally I'd try to avoid omega rotation for reasons related to what Wolfie mentions. Even if you set the physics to None, as a physical object it still must be sending a constant stream of object updates to maintain the appearance of rotation, unlike strictly viewer-side non-physical omega or texture animation.


It's probably another case where animesh would be the most elegant solution and would save resources compared to omega rotations. But it would drive up land impact and therefore might not be an attractive option for such a product.

Share this post


Link to post
Share on other sites

well, IDEALLY, i could use the texture rotation. 

 

the wheel takes a square map (actually a circle in the center of a square), the scale and rotations on the texture are 1, 1, and 0.00.  or, basically, the same thing you would see on the endcap of a prim cylinder.

 

oh wait.  it's doing the same thing on the endcap of a cylinder!!! 

 

OH!  OH FOR!  ::headdesk!::    okay, i did not remember (and the tooltip did not inform me) that one of the "# of frames" parameters was also a rotation AMOUNT parameter, and... okay.  i'm okay now.

 

 

QIE!  brilliant job!  thank you!

for posterity!

llSetTextureAnim(ANIM_ON | LOOP | SMOOTH | ROTATE , 2, 0, 0, 0, TWO_PI, 2.5);

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...