Biran Gould Posted November 13 Posted November 13 I'm holding a hockey stick, and using llRezObjectWithParams to 'fire' the puck, but i'm having trouble getting my projectile to go in the right direction. Heres what i'm currently doing, which works fine, except the puck is being fired, 30 degrees to my left, instead of in the direction i'm facing. ( or perhaps the animation i'm playing makes it look that i'm not looking forwards ) fShootPuck() { string puck = llGetInventoryName(INVENTORY_OBJECT,0); if ( llGetInventoryType(puck) == INVENTORY_OBJECT ) { float vel = llGetTime()*50; vector myPos = llGetPos(); rotation myRot = llGetRot(); vector rezPos = myPos + <1.0, 0.0, 0.25> * myRot; llRezObjectWithParams( puck, [ REZ_POS, rezPos, FALSE, TRUE, REZ_ROT, <0.70711, 0.0, 0.0, 0.70711>, TRUE, REZ_VEL, <vel,0,0>, TRUE, FALSE, REZ_LOCK_AXES, <1,1,1>, REZ_FLAGS, 0 | REZ_FLAG_PHYSICAL | REZ_FLAG_DIE_ON_NOENTRY ]); } } Oh, i'm also using llGetTime() to set the velocity But i'm not sure what i should be adjusting to resolve this issue, Any advice would be appreciated, thanks
Quistess Alpha Posted November 13 Posted November 13 (edited) 3 hours ago, Biran Gould said: ( or perhaps the animation i'm playing makes it look that i'm not looking forwards ) Unfortunately, avatars' exact facing direction is partially viewer-side. Maybe see if you're having the same issue while sitting on a pose stand? Edited November 13 by Quistess Alpha
Biran Gould Posted November 13 Author Posted November 13 I don't have the option to change the animation, i'm just trying to work with the situation.
Love Zhaoying Posted November 13 Posted November 13 If you are using a default camera angle (for some people, that is "behind the avatar"), would the direction of rez possibly be interpreted relative to where your camera is "looking"? Instead of relative to the direction your avatar is "facing" due to some possible animation.. (If you are looking where your avatar is looking, but from behind..)
Extrude Ragu Posted November 13 Posted November 13 These arguments are suspect REZ_POS, rezPos, FALSE, TRUE, The 2nd argument, to which you pass TRUE is whether or not the object should rez at the rezzers root instead of at the specified position. You create rezPos only to not use it. REZ_VEL, <vel,0,0>, TRUE, FALSE, On your velocity arguments, you pass TRUE for local velocity, so this should be fine, but I wonder if the 2nd argument to not additionally inherit the rezzers velocity is intended as if you happen to be moving when you hit your puck it won't account for your movement. 1
Qie Niangao Posted November 13 Posted November 13 1 hour ago, Extrude Ragu said: The 2nd argument, to which you pass TRUE is whether or not the object should rez at the rezzers root instead of at the specified position. No, that shouldn't mean the rezzer's root, but rather the rezzed object's root, as opposed to the geometric center of that rezzed object—basically the difference between llRezAtRoot() and llRezObject(). 1 1
Ron Khondji Posted November 14 Posted November 14 Caveats from llGetPos: When called from the root of an attachment, returns the wearer's region position. To see the position used, enable Develop>Avatar>Display Agent Target and use the red crosshair. If the avatar is sitting on an object, the red crosshair may be hidden by the white one, in the same position. When called in an attachment's child prim, the position given is again relative to the avatar's root position and rotation, but with the offset from the root prim added. Visually, the reported position will only be correct if the object's root is attached to ATTACH_AVATAR_CENTER, at ZERO_ROTATION and ZERO_VECTOR. Moving the attachment's root or changing the attachment point will not affect the reported position. Avatar animation is invisible to the simulator, so it also does not affect the reported position. And from lGetRot: llGetRot incorrectly reports the avatars rotation when called from the root of an attached object, use llGetLocalRot for root prims, instead llGetRot will return an accurate facing for Avatars seated or in mouselook, but only a rough direction otherwise when called from an attached prim. When called in an attachment's child prim, the reported rotation will only be visually correct if the object's root is attached to ATTACH_AVATAR_CENTER, at ZERO_ROTATION. Moving the attachment's root or changing the attachment point will not affect the reported rotation. Avatar animation is invisible to the simulator, so it also does not affect the reported rotation. Also see Single or Root Prims vs Linked Prims vs Attachments.
Wulfie Reanimator Posted November 14 Posted November 14 (edited) On 11/13/2024 at 12:42 PM, Biran Gould said: Heres what i'm currently doing, which works fine, except the puck is being fired, 30 degrees to my left, instead of in the direction i'm facing. ( or perhaps the animation i'm playing makes it look that i'm not looking forwards ) The script is perfectly accurate, the discrepancy in the puck going the wrong way is not something you can fix when you're aiming outside of mouselook (unless you track camera instead of avatar rotation). Edited November 14 by Wulfie Reanimator 2
Love Zhaoying Posted November 14 Posted November 14 32 minutes ago, Wulfie Reanimator said: (unless you track camera instead of avatar rotation). I feel vindicated!!!! 23 hours ago, Love Zhaoying said: If you are using a default camera angle (for some people, that is "behind the avatar"), would the direction of rez possibly be interpreted relative to where your camera is "looking"? Instead of relative to the direction your avatar is "facing" due to some possible animation.. (If you are looking where your avatar is looking, but from behind..)
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now