|
Post by Famer on Sept 27, 2016 16:16:34 GMT
Hey guys!!! This is Famer again... But this time with a Need For Script. Yeah... I was just wondering if... we could just add some script to ensure that when the car collides with the terrain, building,(or whatever it is) to have a sound of the collision and also the sparks on the place of collision.
I've tried using the EventOnContact to start the sound... but.. the sound keeps on repeating. That's a big problem. If the sound keeps on repeating, then it'll sound like as if the car is colliding with the terrain again and again. So, if we can have control over the sound based on the collision force,it'll be great!!! And about the sparks, I don't have any idea of it... Please help me with it.
Regards @famer
|
|
|
Post by nickdh on Sept 28, 2016 0:39:42 GMT
Hi Famer, You should disable the "Looping" check box in the sound source properties. As for the sparks, that should be achievable with the "particles" object. Just put it wherever you want it to be, and set it to "start on contact" in your event on contact properties... Nick
|
|
|
Post by Power Supersport on Sept 28, 2016 6:45:15 GMT
Here you go... everything you'll possibly need...
int time; float contactForce = 50000; Vector3 Contact; void Main () { if (IN_0 > contactForce) { if (time < 3) time += 1; if (time == 1) { iObjectStart (OBJ_22); iObjectLocation (OBJ_0, Contact); iObjectLocationSet (OBJ_44, Contact); iObjectStart (OBJ_44); } } else time = 0;
}
That should do it... Just connect your EventOnContact first, then your soundSource, then the particles...
I hope you find this helpful!
|
|
|
Post by Famer on Sept 28, 2016 10:27:34 GMT
Thanks guys... But Power Supersport, it is not working, I never knew why and I have also checked the script.
|
|
|
Post by Power Supersport on Sept 28, 2016 15:03:00 GMT
Thank you for the congrats... But... I tested the script and it works fine... Do you always check the script? And also, do you check the instructions? And, did you configured your EOC by linking both the ground and the car as MONITOR? Here's a demo project... Attachments:Test.3dr (161.08 KB)
|
|
|
Post by Famer on Sept 28, 2016 17:00:09 GMT
|
|