|
Post by TinSoldier on Jan 16, 2017 17:28:37 GMT
So in my project my cam by design follows a specific ridgidbody, i noticed that the cam wasn't added to the vehicles group, so i add it.
I didn't check my project right away and went to work on other project things.
When i test run the project i notice something changed and wasn't working as designed....
Right away i thought 3drad had damaged my project AGAIN, but decided like last time to search for a problem.
The camchase was the third object i looked at and noticed that by default ( i've known this for ages ) that 3drad auto changes the options to "chase" for each object linked to it... even if its a script... which cant be "chased" .. kinda stupid really, but i assume its done to be a convenience..
so i change the group object setting back to ignore and for all linked objects not being chased.., and don't you know my project starts working properly again..
Apparently the camchase was trying to follow either the group object or objects in the group.. cant say which it is.. but that was the problem, the cam was trying to follow the wrong object(s) and throwing off other cam position dependent things.
I'm glad i make a point of checking the camchase settings and reset to "ignore" when it should be.
You mite wanna do this in your projects too, just to avoid unwanted camchase issues.
|
|
|
Post by NicusorN5 on Jan 16, 2017 18:16:53 GMT
This never happend to me , everytime , before I click OK, I check every parameter of the object... :V
|
|
|
Post by GH Games on Jan 16, 2017 19:03:53 GMT
Thanks for pointing this out, this will be a good thing to watch out for
|
|
|
Post by indiedev on Jan 17, 2017 1:41:42 GMT
so basically if you unlink/relink the group it resets to default of chase, but if you keep it linked it will stay where you set it. my group was set to chase too as i often relink during editing, but never had your issue as: 'All active objects that are linked to the camera in the List Editor are considered as targets, but only one of them is actually used runtime.' i assume it uses the 1st object in the list, which in my case is the rigid, so maybe you had a group or script at top of list.
|
|
|
Post by TinSoldier on Jan 17, 2017 18:04:41 GMT
indiedev yeah cant say now what the list order was and i was using "chase" mode on one object only. I know that using "look at" and multi-targets the camchase will look at the closest target.. that works fine. it's so hard to finish a project in 3drad with little issues like this popping up, for me the effect was very noticeable this time, but i can totally image a different project where this happens but the effect is much smaller and may cause us to adjust other settings instead to compensate or try too. That wasn't the only problem that i found... While playing with a dif project ( a tank project which has 10 wheel objects) i added skinmeshs to each wheel, all was fine no problems. While edding some script that doesn't effect the wheels or their attached skinmesh's , i test run the project and see all 10 skinmesh's acting as though an offset had be applied to each, they were all moving in sync with this offset, i've never seen this happen before. I didn't try to look for an issue, i assume 3drad once again damaged the properties because i saved and reloaded the project and the problem was still there. My best solution was to load one of the auto-save projects that didn't show the problem to recover the project. i haven't done anything with the project yet since this error showed up 2 days ago.. just out of curiosity i think i'll load back in an auto save version with the problem, just to see if i can find out what went wrong... I love a challenge...
|
|
|
Post by TinSoldier on Jan 17, 2017 18:49:02 GMT
Welp, i wasn't able to find a copy of the damaged project in my auto-save, and i loaded everyone to test ..
I can only assume further edits must have overwritten it ..
|
|
|
Post by indiedev on Jan 18, 2017 3:05:08 GMT
i don't think rad is 'damaging' your project, usually corruption is due to user made changes, just disable the changes you made manually, and unlink all links to wheels 1 by 1 till you find which causes it, i'm guessing your script was linked to tank body which is linked to wheels.
|
|
|
Post by TinSoldier on Jan 18, 2017 3:12:38 GMT
UPDATE: I found an issue and i can reproduce it in the current project, but can't say why its happening... in my current project when i edit one specific script, then click OK, run the project the wheel skinmesh issue returns. If i instead edit and save the project first, reopen and load and run the project, the issues doesnt happen. to make matters worse, removing the "group" object that was involved with the first "chase" cam issue, cause's this same script to be corrupt... By corrupt i mean, there's a value print object listed and is linked to the script, it also shows in the top OBJECT list number, but on the bottom OUTPUT list, this valueprint is positioned in the wrong place and its output value numbers have change because of this and cause's the script to report a invalid OBJECT output... in the bottom screencap you'll notice object 374 listed in the top object handles (last on the list). but that obj input and output registers are missing on the list, object 352 registers being the last in the list (357).... So now i'm thinking the script object it's self maybe the source of our project issues, or maybe the script is the victim of what ever issue is going on here, can't say for sure at this point..... for completeness here's the whole script for your viewing pleasure PS this script worked fine with no errors till this object "issue" has come up..... /// objects script interfaces with
int objTarget= OBJ_308;
int objTurret= OBJ_0; int objGun= OBJ_22;
int objCar= OBJ_44; int objCam= OBJ_66;
int objSprite= OBJ_352; // i3DLocationToScreen(Vector3,Vector3,Int Object)
// objects to test with iObjectScan in bool scanFromObject(int obj) int objTerrain= OBJ_88; // #4 int objBall= OBJ_132; // #6 int objRandomCar= OBJ_264; // #12 int objRandomCar2= OBJ_286; //#13 iObjectHandle(int); // add all collision objects to the above testObj var list int[] testObj= {objBall, objRandomCar, objRandomCar2, objTerrain};// int[] Damage= {0,0,0,0,0,0}; int[] Hit= {0,0,0,0,0,0};
int objPrnDist= OBJ_176;
// position and trigger explosion sound void boom(Vector3 loc) { objPos(OBJ_220, loc); iObjectStart(OBJ_220); // network hitlocation iNetFloatArraySet(10,loc.x); iNetFloatArraySet(11,loc.y); iNetFloatArraySet(12,loc.z);
if(Hit[0]==1)Damage[0]+=1; if(Hit[1]==1)Damage[1]+=1; if(Hit[2]==1)Damage[2]+=1; if(Hit[3]==1)Damage[3]+=1; if(Hit[4]==1)Damage[4]+=1; if(Hit[5]==1)Damage[5]+=1; }
void valPrnDistance(float v){OUT_176= v;};
void spriteToTarget() { float s=0.5; Vector3 vScreenCoords; i3DLocationToScreen(vScreenCoords, contactPoint, objCam); iObjectLocationSet(objSprite, vScreenCoords); float dx= iFloatAbs(vScreenCoords.x); float dy= iFloatAbs(vScreenCoords.y); s= iFloatSqrt(dx*dx+dy*dy); s= (s<1)?(1.0-s)/2.0+0.5:0.5; s= iFloatSqrt(s); iObjectScaleSet(objSprite, vecLen(Vector3(1,1,1), 3.7*s)); OUT_352= s; OUT_353= s; OUT_354= 1.0-s; OUT_355= 1.0-s; }
///
Vector3 vecLen(Vector3 v, float l) {iVectorLengthSet(v,v,l);return v;} Vector3 vNorm(Vector3 v) {iVectorLengthSet(v,v,1);return v;} Vector3 vecRot(Quaternion q, Vector3 d) {Vector3 r;iVectorRotate(r,d,q);return r;} Vector3 objPos(int obj) {Vector3 l; iObjectLocation(obj, l); return l;} Vector3 objPos(int obj, Vector3 v) {iObjectLocationSet(obj, v); return v;} Quaternion objRot(int obj) {Quaternion q; iObjectOrientation(obj, q); return q;} Quaternion qMul(Quaternion q1, Quaternion q2) {Quaternion qt;iQuaternionMultiply(qt,q1,q2);return qt;} // q1+q2 Quaternion qDelta(Quaternion q1, Quaternion q2) {return qMul(q1, qInv(q2));} // q1-q2 Quaternion qInv(Quaternion q) {return Quaternion(q.x,q.y,q.z,-q.w);} // -q float angleWrap(float a) {while (a<-180) a+=360; while (a> 180) a-=360; return a;} float sign(float n){return n<0?-1:n>0?1:0;}
Quaternion VectorOrientation(Vector3 v){ Vector3 v1,v2; iVectorLengthSet(v1,v,1); iVectorLengthSet(v2,v,2); return QuatGetLookAt(v2-v1); } Quaternion QuatGetLookAt(Vector3 direction){ Vector3 up = Vector3(1,0,0); Quaternion orientation; iQuaternionLookAt(orientation,direction,up); return orientation; } float asin(float value) { // aka, R_asin iDLLArraySet(0,value); iDLLCall(MathDLLHandle,"asin",0); float f = iDLLArrayGet(0); return f; } float acos(float value) { // aka, R_acos iDLLArraySet(0,value); iDLLCall(MathDLLHandle,"acos",0); float f = iDLLArrayGet(0); return f; } float atan2(float value1, float value2) { // aka, R_atan2 iDLLArraySet(0,value1); iDLLArraySet(1,value2); iDLLCall(MathDLLHandle,"atan2",0); return iDLLArrayGet(0); }
/// /// GForceImposters
int[] gfiObj= {OBJ_242, OBJ_154, OBJ_198}; // particles & G-Force int gfiObjs;
Quaternion qGFI; void GForceImposters_init() { gfiObjs= gfiObj.length(); for(int j=0;j<gfiObjs;j++) { iObjectImpostersCreate(gfiObj[j],1); iObjectImposterHide(gfiObj[j],0); } iObjectOrientation(gfiObj[1],qGFI); } void GForceImposters_deInit() {for(int j=0;j<gfiObjs;j++) iObjectImpostersDestroy(gfiObj[j]);} void GForceImposters() { for(int j=0;j<gfiObjs;j++) { // position & show imposters iObjectImposterSet(gfiObj[j],0,qGFI,contactPoint); iObjectImposterShow(gfiObj[j],0); } boom(contactPoint); }
bool key, _key, rKey; bool triggered() {_key= (IN_110 > 0); rKey= _key and not key; key= _key; return rKey;}
/// scanFromObject ///
float scanRange= 2048; Vector3 contactPoint, contactNormal; float contactDist; bool scanFromObject(int obj) { bool contacts; Vector3 scanOrigin= objPos(obj); Quaternion q= objRot(obj); Vector3 vScan= vecLen(vecRot(q, Vector3(0,0,1)), scanRange); contacts= false; contactDist= -1; contactPoint= scanOrigin+vScan; Vector3 rContactPoint, rContactNormal; float dist; Hit[0]= 0; Hit[1]= 0; Hit[2]= 0; Hit[3]= 0; Hit[4]= 0; Hit[5]= 0; int arrayLen= testObj.length(), i, nContacts; for(i=0;i<arrayLen;i++) if (iObjectScan(testObj[i], scanOrigin, vScan, 0, rContactPoint, rContactNormal)) { bool isCloser= contactDist>(dist= iVectorLength(scanOrigin-rContactPoint)); if ((!contacts) or isCloser ) { contactDist= dist; contacts= true; contactPoint= rContactPoint; contactNormal= rContactNormal; //Mark target as hit Hit[i]=1; nContacts+= 1; } } return contacts; }
/// /// setTurretRotation // Actuate hinge motors to rotate the turret and pitch the barrel
void setTurretRotation() { Vector3 v; float AngleX, AngleY; v= vecRot(qDelta(qTarget, objRot(objTurret)), Vector3(0,0,1)); AngleY= 15*angleWrap(57.29578231*atan2(v.x, v.z)); v= vecRot(qDelta(qTarget, objRot(objGun)), Vector3(0,0,1)); AngleX= 15*angleWrap(57.29578231*atan2(v.y, v.z)); if (iFloatAbs(AngleX)>60) AngleX= sign(AngleX)*60; if (iFloatAbs(AngleY)>60) AngleY= sign(AngleY)*60; AngleX= iFloatAbs(AngleY)<120?AngleX*((120.0-iFloatAbs(AngleY))/120.0):0; OUT_310= AngleY; OUT_332= AngleX; }
/// /// Turret Control
Quaternion qTarget; int MathDLLHandle= 0; // atan2 needs RadMath2.dll bool Active= false; void Main() { if(iInitializing()) { // check for proper OBJ numbers objTerrain= iObjectHandle(4);//OBJ_88; // #4 objBall= iObjectHandle(6);//OBJ_132; // #6 objRandomCar= iObjectHandle(12);//OBJ_264; // #12 objRandomCar2= iObjectHandle(13);//OBJ_286; //#13 iObjectHandle(int);// iNetFloatArraySet(10,-1); iNetFloatArraySet(11,-1); iNetFloatArraySet(12,-1); // update radmath location before compiling !!!!!! MathDLLHandle = iDLLLoad(".\\3DRad_res\\objects\\Script\\RadMath2.dll"); if (MathDLLHandle==0) MathDLLHandle = iDLLLoad(".\\3DRad_res\\objects\\Script\\RadMath.dll"); qTarget= objRot(objCar); GForceImposters_init(); } else if (iDeinitializing()) { if (MathDLLHandle != 0) iDLLUnload(MathDLLHandle); GForceImposters_deInit(); } else if (MathDLLHandle != 0) { // Determine position and distance of what's at screen center Vector3 targetContactPoint; float targetDistance; if (scanFromObject(objCam)) { valPrnDistance(targetDistance); iObjectShow(objPrnDist); } else iObjectHide(objPrnDist); targetContactPoint= contactPoint; targetDistance= contactDist; // qTarget= (targetDistance>-1) ? VectorOrientation(vNorm(targetContactPoint-objPos(objTurret))) : objRot(objCam); qTarget= VectorOrientation(vNorm(targetContactPoint-objPos(objTurret))); setTurretRotation(); // Determine position and distance of what the cannon is aimed at scanFromObject(objGun); // get impact point spriteToTarget(); // if firing a shot, not at nothing, create an explosion where the cannon is aimed if (triggered()) // and targetDistance>-1) GForceImposters(); // create explosion at target point } if(iNetLocalPlayerMachine()>-1 && !iNetSessionTerminated())Active=true; else Active=false; iNetFloatArraySet(0,Damage[0]); iNetFloatArraySet(1,Damage[1]); iNetFloatArraySet(2,Damage[2]); iNetFloatArraySet(3,Damage[3]); iNetFloatArraySet(4,Damage[4]); iNetFloatArraySet(5,Damage[5]); OUT_374=iNetFloatArrayGet(3); // used for testing if(Active && iNetLocalPlayerMachine()==0) iNetFloatArraySendEx(0,100,0,false); // send 0 to 99 // reset loc after shot iNetFloatArraySet(10,-1); iNetFloatArraySet(11,-1); iNetFloatArraySet(12,-1);
}
|
|
|
Post by indiedev on Jan 18, 2017 3:58:29 GMT
long scripts make my brain hurt and avoiding them is the whole reason i use rad, i only do ones with a few objects/functions so pinpointing problems is easier for me.
but surely if you make the group inactive or unlinked instead of removing, it would not corrupt?
|
|
|
Post by TinSoldier on Jan 18, 2017 4:29:23 GMT
well i'ld like to test this idea indiedev , but not surprisingly, 3drad isn't showing the object script error now with the project. The skinmesh alignment issue is still there and can be reproduced with this project though.. Something's going on with 3drad, i just cant put my finger on the problem... i'm starting to think the only "issue free" way to create a project, mite be to NOT use the script object at all.. This would really make our projects boring and cookie-cutter in style..
|
|
|
Post by GH Games on Jan 18, 2017 12:22:40 GMT
TinSoldier I have a question and I don't want you to take this the wrong way, but from the Script above you obviously seem quite advanced in the Language, have you ever thought of moving to a more advanced Engine like UE4 or Unity? Or Is it that 3D Rad is so mint you just have to stay
|
|
|
Post by Famer on Jan 18, 2017 17:14:03 GMT
Thanks TinSoldier, I've noticed this too... But Didn't know that it'll affect the scripts... Thanks for pointing out!
|
|
|
Post by TinSoldier on Jan 18, 2017 18:45:22 GMT
I would love to take credit for this script, but a user named chronocide from the original 3drad forum did this for me. chronocide wasn't to active on the forums. I didn't ask for help or anything, he came to me and offered to help with my project because he liked my modeling designs. From what he supplied, ( i assume he is a he ) this guy is an accomplished programmer, probably in C and picked up angle code very quickly due to their similar styles . I think jestermon would have trouble completing with him in a scripting challenge.. IMO There's parts of this script i cant even figure out, but it all works without errors.. I was able to add some stuff, like networking so the explosion locations and damage points would work properly. TinSoldier I have a question and I don't want you to take this the wrong way, but from the Script above you obviously seem quite advanced in the Language, have you ever thought of moving to a more advanced Engine like UE4 or Unity? Or Is it that 3D Rad is so mint you just have to stay
|
|
|
Post by GH Games on Jan 18, 2017 18:50:44 GMT
Oh I see okay Shame taht guy wasn't active it sound sliek he could be really helpful. Then again he helped you so I guess he was. Thanks for answering bro
|
|