|
Eaglebird Cameron
YTMND *********
Join date: 1 Jul 2006
Posts: 68
|
08-09-2006 10:53
Anyway, to the point. I'm going to try (note, -try-) tackling something to simulate a 'monster' from a game. Basically, I have a model, which may or may not be animated, that roams around on its own. At a certain range, it can 'see' an avatar, and will proceed to move closer. Well, a few problems arise. I can have separate sensor scripts in child objects (only going to be needing about 2). The first one is the model itself, following the avatar or looking for one. So, the sensor event being raised, the model needs to find a point between itself and the avatar, then remain about 10-15m away. This doesn't seem too hard, to be honest, just a follow script modified to find a distance and then convert back to a vector. However, the follow script I have makes objects physical. I'd really not prefer this, but that's not the current problem at hand. I need the 'model' to turn to face the avatar it senses. I have a script designed to do this, but it rotates ALL axes, not just the z. If anyone knows how to make it ignore other axes rotations, or change a rotation in a quaternion form to only use a z rotation to be used in llRotLookAt();, it'd be helpful. Right now my follow script doesn't 'look at' the target, it just moves to an offset. The roaming part would be raised on a no_sensor event, where it just walks around and looks for someone. The only problem is I don't want it crossing sims or going off world. I can use offworld to avoid invalid locations, but not sim-crossing. Third, I -want- to animate it, but I have my doubts. It is a four-legged creature. I've seen someone do the animation on objects before, but it was an object attached to themselves. So my biggest problem here is making the legs rotate around to simulate walking, but to keep up with the body. Fourth, is more of a problem than me looking for suggestions. I have a child prim attached to the parent prim (the body) of the monster, using a sensor to llLookAt and watch the avatar, but when linked, it doesn't move. If I recall correctly, child prims could turn, rotate, and move in relation to the parent. So now that you've read all that, or tl;dr'd, any ideas?
|
|
Xixao Dannunzio
Owner, X3D Enterprises
Join date: 20 Mar 2006
Posts: 114
|
08-09-2006 11:12
That's asking for quite a bit of help for L$5... Scripts are very time-consuming, and for users like me, our SL income is based on the work we put in. L$5 translates to be roughly $0.018 USD... suppose it takes an hour to get the script right? I don't want to work for a penny an hour...
|
|
Eaglebird Cameron
YTMND *********
Join date: 1 Jul 2006
Posts: 68
|
08-09-2006 11:16
From: Xixao Dannunzio That's asking for quite a bit of help for L$5... Scripts are very time-consuming, and for users like me, our SL income is based on the work we put in. L$5 translates to be roughly $0.018 USD... suppose it takes an hour to get the script right? I don't want to work for a penny an hour... The topic has nothing to do with my question. It was a joke. If you really want commission for help, I'll give whoever 50L$
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
08-09-2006 11:30
From: Eaglebird Cameron I need the 'model' to turn to face the avatar it senses. I have a script designed to do this, but it rotates ALL axes, not just the z. If anyone knows how to make it ignore other axes rotations, or change a rotation in a quaternion form to only use a z rotation to be used in llRotLookAt();, it'd be helpful. vector forward = llRot2Fwd( llGetRot() ); // or forward = monster_pos - target_pos etc. vector forward_flat = llVecNorm( <forward.x, forward.y, 0.0> );
this keeps your 'look at' vector on flat XY plane, limiting rotation to just Z axis. You can then cross fixed 'up' vector with this vector to get local 'left' vector, and use these two )forward and left) in llAxes2Rot() to generate rotation that'll make your object face the target.. or alternatively, you could likely use llRotBetween() for forward and forward_flat, then multiply the result with current rotation to arrive to the same end effect. From: someone The only problem is I don't want it crossing sims or going off world. I can use offworld to avoid invalid locations, but not sim-crossing. Check for your position and if movement is going to take you outside 0-255 local coordinates, change direction of movement? ^^;
|