|
Post by fe2k10 on Mar 1, 2017 18:18:49 GMT
Hello guys,
I'm working hard on an airplane game, and one of the things I'm having trouble with is in making the game differentiate a soft landing from an impact with the ground.
Is there any way to make the game identify a strong impact in a different way? So I could stop the game and show an accident message or something.
I thought about making a different rigidbody for the places where it is possible to land, creating another rigidbody to detect any impacts with the ground or buildings, yet would have to deal with the strongest impacts against the runway.
|
|
|
Post by GH Games on Mar 1, 2017 18:33:35 GMT
Add an EventOnContact Object, Link it between the airplane and the terrain, check the "Use contact force bounds" and specify the values (E.G. 0/20 for soft landing and 0/60 for hard landing and then 0/100 for #Deleted lol). You can either use a Script to monitor the landing type (if you want an example just ask me) or you can just set up a couple of these objects.
Good luck and hope it helps!
EDIT: The values may have to be as follows for this way to work without scripts:
Soft landing: 0/20 Hard landing: 20/40 #PlaneIsNowAsh: 40/100
|
|
|
Post by fe2k10 on Mar 1, 2017 18:50:11 GMT
Hello GH Games, I tried to do as you said, but:
- When I create an EventOnContact between the plane, the propeller and the ground, putting the "Use contact force bounds" on 0/60 for example, in relationships ignoring the plane and the ground, stopping the propeller, nothing happens (Even if i hit the ground as hardest as i can).
- When I create an EventOnContact between the airplane, the propeller and the ground, by putting the "Use contact force bounds" in 0/60 for example, in relationships monitoring the plane and the ground, stopping the propeller, the airplane does not work even being stopped (Even if I put the values in 0/999 or 999/999).
Note: I did not change any other option in EventOnContact.
|
|
|
Post by GH Games on Mar 1, 2017 19:09:29 GMT
Hmm, I don't get why the plane is not working at all. You could try a Script, try this (no clue if it will work just made it):
void Main() { if(IN_0 <= 20){ //Soft landing } if(IN_0 >= 21){ //Hard landing } if(IN_0 >= 60){ //Destroyed } }
IN_0 is the INPUT of the Contact Force.
|
|
|
Post by fe2k10 on Mar 1, 2017 20:39:00 GMT
Unfortunately I still have not been able to make the script work, but I have discovered something interesting, if I put the plane and ground as monitoring (reference), and the propeller to stop, and the "Use contact force bounds" with 0.01 and 60, the plane hits 200km/h and then stops working.
Unfortunately this still does not solve my problem because I need it to take off, and setting to 0.02/60 already causes it to not detect very heavy collisions. Any tips on what might be happening?
|
|
|
Post by GH Games on Mar 1, 2017 21:43:20 GMT
I probably should have said at the start but... I think that the plane needs to be a RigidBody as well as the Terrain. This makes sense because a SkinMesh will just go through anything it touches.
It all goes on speed by the way, so in the air and falling the faster you are going the heavier you are, so you might need to lower the bounds maybe. I have never made a plane game in 3D Rad before so I honestly am not sure and wish I could help more.
I hope this does help thoguh.
|
|
|
Post by fe2k10 on Mar 2, 2017 11:00:45 GMT
For now I have not put any Skinmesh, but the first contact with the ground is not made by the Rigidbody itself but by the wheels, I do not know if this changes anything at all, I'm putting the Rigidbody and the wheels in EventOnContact ...
|
|
|
Post by GH Games on Mar 2, 2017 11:42:08 GMT
Are the wheels seperate from the actual plane model? if they are then you need to monitor these too.
|
|
|
Post by fe2k10 on Mar 2, 2017 11:49:54 GMT
Yes, I'm monitoring all of them, apparently the way I did it detects the collision at a certain speed, strangely a sudden vertical descent with impact to the ground is not increasing the speed of the plane, just reducing the altitude, so even an extremely strong impact vertically against the ground is not generating as much force as running at 200km/h in the runway ...
|
|
|
Post by GH Games on Mar 2, 2017 13:45:56 GMT
Oh okay. I'm not sure where to go now bro, sorry I couldn't help you more, like I say I have never done anything like what your doing. I know that there was once a plane game (maybe the example one) that was pretty good and had all the physics nailed. Maybe try looking for that? It might take a bit of digging.
|
|
|
Post by fe2k10 on Mar 2, 2017 17:41:58 GMT
I think I managed to do it the hard way, which would be to put an EventOnValue that causes a rigidbody to appear above a certain speed to detect collisions, and disappear when you are at the ideal speed. Not so practical to do but I think it worked in the game.
Now the problem seems to be simpler to solve, when the plane crashes I'd like it to stop at the crash site, and do not jump out and then walk until it loses speed.
Putting a Velocity at -5 seems to make it stay in place, but the wheels keep spinning and the plane walks around, does it have some way to destroy everything and make it stop walking?
|
|
|
Post by GH Games on Mar 2, 2017 19:19:04 GMT
Now the problem seems to be simpler to solve, when the plane crashes I'd like it to stop at the crash site, and do not jump out and then walk until it loses speed.
Putting a Velocity at -5 seems to make it stay in place, but the wheels keep spinning and the plane walks around, does it have some way to destroy everything and make it stop walking? I have nooooooo clue what any of this means. Planes, walking, jumping... Huh?
|
|
|
Post by fe2k10 on Mar 2, 2017 19:38:37 GMT
Only 3DRad things , when the plane collides with the ground it jumps, even if i order it to stop, it will jump less and less until losing speed and walking, taking a long time to stop. This does not seem very realistic, it would be great if it simply stopped at the crash site.
|
|
|
Post by GH Games on Mar 2, 2017 21:07:41 GMT
You could lock the plane on the same X axis as the terrain maybe? That would make it come to a halt most likely.
|
|
|
Post by TinSoldier on Mar 3, 2017 1:48:02 GMT
Try this, copy & past this into a script object all by it's self. connect it to the plane rigidbody object and to what ever object or script that resets the plane. and also uncheck "working at start"
Also connect it to the crash event_On_collision object.
The idea here is when this script is started with the collision object, it should keep the plane in the location of the crash.
Then when the plane is reset or the project is.. reset this script too .
bool Once=false;
Vector3 PlaneCrashSite(0.0f,0.0f,0.0f);
void Main(){ if(!Once){ Once=true; iObjectLocation(OBJ_0,PlaneCrashSite); /// set OBJ_0 to the plane rigidbody object } iObjectLocationSet(OBJ_0,PlaneCrashSite); }
|
|
|
Post by indiedev on Mar 4, 2017 9:29:42 GMT
....or, just use the Restitution value of rigid body, the help file explains it, you need to tweak much to get what you want, the default is just for starters.
|
|