Jump to content

darkstylerz

Resident
  • Posts

    12
  • Joined

  • Last visited

Everything posted by darkstylerz

  1. Hello, I got problem with making my guard vehicle work properly. Once I set it stationary, I can use dialog box to get avatar coordinates, and it will fire at anyone + turret follows them around. I use this to get avatar position: vector target = llList2Vector(llGetObjectDetails(llList2Key(peopleK, person), [OBJECT_POS]), 0);But once I make it moving (turn physics on), the rotation breaks and turret won't follow anything. I know it does have something to do with root prim since this one works when stationary and when it have to update it's coordinates too fast it just loses it: vector p = llGetPos(); llLookAt(p + (target + <1.0, 0.0, 0.0> - p) / llGetRootRotation(), 3.0, 1.0);I put this script in timer, for it to update on avatar position every 0.2s. I have no idea what other function I can use to make it rotate when physical. Thank you for help.
  2. Hello, I have learned a bit more about constructing stuff, but I got new problem. https://i.imgur.com/tvGxORU.jpg There is the red box I want to use the axis of turret to determine it's location, being positioned always in front of the gun barrel. It's own axis will be used as a seat, and that is not a problem. I kinda want it to support camera, so I can have the view coming always from the gun barrel like here: https://i.imgur.com/CmCEbMj.png So you kinda sit on box, and it goes with you, always pointing through reticle no matter what. Avatar is no problem, since I wrote script that hides it. It will just be lovely if you actually seen through the gun instead of coupola. I can write quite a lot of things, but those rotation relation things make my brain melt. Please help. Anyone who helps receives finished product for free. Thank you!
  3. Hello, I have a problem with pivots of my meshes. First problem was with the position of axis in general, as it often offcentered object. Fixed it doing this: http://puu.sh/gRPvO.jpg build a box around object with different material group, so it overlaps main shape of object. Manipulated vertexes + set pivot to center until satisfied, looking through where the pivot ends up. For such simple objects the SL seems to always hit with no miss. Used scale tool to get the sides equally covered. Once put in game, set the pink face to transparent: http://puu.sh/gRPQh.jpg BUT Now I got problem with axis facing wrong way. Objects X Y Z coordinates are always mixed, rotating them in 3DS max does nothing, as well as rotating model. How do I get them right? Thank you. EDIT: I managed to fix one of my least broken objects by using mirror command in 3dsmax. I will report back if I learn to use it properly...
  4. rotation a = llGetCameraRot()/llGetRootRotation();vector FWD = llRot2Fwd( a);vector UP = < .0, .0, 1.0 >;vector LEFT = llVecNorm( UP%FWD);float downLimit = (100*DEG_TO_RAD);float upLimit = (80*DEG_TO_RAD);//a = llAxes2Rot( LEFT%UP, LEFT, UP);//llSetLinkPrimitiveParamsFast( 2, [PRIM_ROT_LOCAL, a]); // turretif ( FWD.z > llCos( upLimit) ) FWD = llVecNorm( LEFT%UP + UP/llTan( upLimit));else if ( FWD.z < llCos( downLimit) ) FWD = llVecNorm( LEFT%UP + UP/llTan(downLimit));a = llAxes2Rot( FWD, LEFT, FWD%LEFT);llSetLinkPrimitiveParamsFast( LINK_THIS, [PRIM_ROT_LOCAL, a]); // gun Thank you, this works perfectly now. EDIT: Thank you for the 1 prim use advice. But the problem I encountered there is that link changes whenever I detach / attach things to tank, causing chaos in all scripts (example can be track script I wrote, that made textures wreck in whole model, but cannot be used normally, as depends on acceleration / velocity perms. Also some links are moved instead of others, I don't know why. Example is script integer righttrack = 18;llSetLinkTextureAnim(righttrack, ANIM_ON | SMOOTH | LOOP, ALL_SIDES,0,0,0.0, 1,2); This causes link 4(!) to move, even that link 18 is indeed a track. Little vid of script working: Would you like a copy of that tank once I finish?
  5. You might be right, I am bit careless with scripts, started not so long ago. I used to always nourish my artistic side of soul. Seeing lots of random numbers and things makes my head hurt for sure. Wish I had your brain ;D
  6. This is how I made the pivot perfectly fit with not much effort. http://puu.sh/gRPvO.jpg build a box around object with different material group, so it overlaps main shape of object. Manipulated vertexes + set pivot to center until satisfied, looking through where the pivot ends up. For such simple objects the SL seems to always hit with no miss. Used scale tool to get the sides equally covered. Once put in game, set the pink face to transparent: http://puu.sh/gRPQh.jpg
  7. default{ state_entry() { llSetTimerEvent(0.2); } timer() { llRequestPermissions(llGetOwner(),PERMISSION_TRACK_CAMERA); rotation a = llGetCameraRot()/llGetRootRotation();vector FWD = llRot2Fwd( a);vector UP = < .0, .0, 1.0 >;vector LEFT = llVecNorm( UP%FWD);float downLimit = (-80*DEG_TO_RAD);float upLimit = (80);//a = llAxes2Rot( LEFT%UP, LEFT, UP);//llSetLinkPrimitiveParamsFast( 2, [PRIM_ROT_LOCAL, a]); // turretif ( FWD.z > llCos( upLimit) ) FWD = llVecNorm( LEFT%UP + UP/llTan( upLimit));else if ( FWD.z < llCos( downLimit) ) FWD = llVecNorm( LEFT%UP + UP/llTan(downLimit));a = llAxes2Rot( FWD, LEFT, FWD%LEFT);llSetLinkPrimitiveParamsFast( LINK_THIS, [PRIM_ROT_LOCAL, a]); // gun }} This is the closest I could get it to work. It causes however the cannon to snap only to high and low limit: default{ state_entry() { llSetTimerEvent(0.2); } timer() { llRequestPermissions(llGetOwner(),PERMISSION_TRACK_CAMERA); rotation a = llGetCameraRot()/llGetRootRotation();vector FWD = llRot2Fwd( a);vector UP = < .0, .0, 1.0 >;vector LEFT = llVecNorm( UP%FWD);float downLimit = (-10);float upLimit = (80);//a = llAxes2Rot( LEFT%UP, LEFT, UP);//llSetLinkPrimitiveParamsFast( 2, [PRIM_ROT_LOCAL, a]); // turretif ( FWD.z > llCos( upLimit) ) FWD = llVecNorm( LEFT%UP + UP/llTan( upLimit));else if ( FWD.z < llCos( downLimit) ) FWD = llVecNorm( LEFT%UP + UP/llTan(downLimit));a = llAxes2Rot( FWD, LEFT, FWD%LEFT);llSetLinkPrimitiveParamsFast( LINK_THIS, [PRIM_ROT_LOCAL, a]); // gun }} setting it like this causes cannon to stop at desired high on top, but botom range still goes all way down. And snapping occurs on different hights. I am currently trying to work out new way of making cannon geometry perfect, will share it in a moment once it is ready.
  8. Thank you, it works, but still I would like to know if child prims can be rotated around center of root prim. Maybe I am doing something wrong, but all they do is they spin around. Taking the dual cannon behavior it must be a way to make it move independently in both axis? EDIT: default{ state_entry() { llSetTimerEvent(0.2); } timer() { llRequestPermissions(llGetOwner(),PERMISSION_TRACK_CAMERA); rotation a = llGetCameraRot()/llGetRootRotation();vector LEFT = llRot2Left( a);vector UP = <0, 0.0, 0.0001>;a = llAxes2Rot( LEFT%UP, LEFT, UP);llSetLinkPrimitiveParamsFast( LINK_THIS, [PRIM_ROT_LOCAL, a]); }} I made it like this, and it acts like it should. The only concern left is that I can't make cannon wiggle up and down, archieving it's rotation around as well. It causes cannon eaither shake if I use 2 of your scripts, or wildly go around. I have learned that items need to be done properly. But for some reason they are not having quite same axles as they do in 3DSmax. Are there any ways to limit the cannon travel? Turn to some degree and stop?
  9. http://puu.sh/gQKTa.jpg basically yeah, like this. I am already trying to make main cannon move up down too, I think I will use the same script you are writing, but first will be using the root rot once ready + limited (still no idea how) self prim rot. Orange shows root prim and it's center. I have seen cannon done way so game gives it local prim somewhere in the middle: http://puu.sh/gQLc6.png But is it possible for such object to listen 2 commands at once?
  10. Thank you for answer. I tried the script, and it works well, but child prims still rotate around their own prims, not using the root prim. Also if other prim uses the same script (cannon barrel) it swings aimlessly in all directions. Thank you
  11. Hello, thank you for answering. I need help with rotating the tank turret, so it follows where camera points, using just one axis, around the root prim of object. Just like it will do on WOT or other tank games. Thank you.
  12. Hello, I have been working on the script that moves the linked object where the camera is pointing. For use in vehicles, for turret or something. Could you help me with it? Using the standard one I found somewhere is is a mess, and objects tend to stand to the side: //Camera Follower Script //llGetCameraPos & llGetCameraRot Example //By Nika Rugani integer perm_track = 0x400; float second_check = 0.1; vector object_offset = <0,0,2>; //Offset of the cameras position where the object will set itself integer die_channel = 0; string die_command = "/die"; quickPosRot(vector pos, rotation rot) {//This way you don't have the 0.2 second sleeps from llSetPos and llSetRot llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION, pos, PRIM_ROTATION, rot]); } default { on_rez(integer a) { llResetScript(); } state_entry() { llRequestPermissions(llGetOwner(), perm_track); } run_time_permissions(integer permission) { if(permission == perm_track) { llSetTimerEvent(second_check); llListen(die_channel, "", llGetOwner(), ""); } else { //llResetScript(); //Remove comment to loop the process of requesting permissions if user deny's permission //llDie(); //Remove comment to kill the object if user deny's it } } listen(integer channel, string name, key id, string str) { str = llToLower(str); if(str == die_command) { llDie(); } } timer() { vector c_pos = llGetCameraPos(); //Get Users Camera Position rotation c_rot = llGetCameraRot(); //Get Users Camera Rotation c_pos = (c_pos+object_offset*c_rot); //Apply the offset to the position quickPosRot(c_pos, c_rot); //EXECUTE ORDER! } } So I modified it to have something like this at the timer section. timer() { vector rotated = <0, 0, 0>; vector rotated2 = <0, 0, 1>; rotation rot; rotation rot2; rotated *= DEG_TO_RAD; rot = llEuler2Rot( rotated ); rot2 = llEuler2Rot( rotated2 ); rotation c_rot = llGetCameraRot()+rot2 - llGetCameraRot()+rot; //llSetLocalRot(true); vector c_pos = llGetCameraPos(); quickPosRot(c_pos, c_rot); //EXECUTE ORDER! } What it does, it turns the object towards the direction vehicle is turning, one axis wise. But it is working poorly and not constant. On the other one I have that script: rotation rot_xyzq; default { state_entry() { llListen(-80001,"", NULL_KEY, ""); } listen(integer channel, string name, key id, string message) { if (message == "turret left") { // speak out loud! vector xyz_angles = <0,0,3>; // This is to define a 1 degree change vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to Radians rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation llSetLocalRot(llGetLocalRot()*rot_xyzq); //Do the Rotation... } if (message == "turret right") { // speak out loud! vector xyz_angles = <0,0,-3>; // This is to define a 1 degree change vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to Radians rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation llSetLocalRot(llGetLocalRot()*rot_xyzq); //Do the Rotation... } } } I took it from somewhere and edited for my needs, and it turns turret with correspondent gestures. Do you know any way to make cannon move smoothly and aim where I want it? I will give the finished tank model to anyone who can guide me well. Thank you for help.
×
×
  • Create New...