Rider Help: Death from the collision with the certain side of Rider

Updated 1 day ago in  [R] Tutorials
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
15 on January 16, 2018

Hello, I’m currently trying to recreate a Rider Replica from the video with some improvements. I’ve already made a delay for the rotation from the first CollisionExit to prevent a rotation while jumping between two small obstacles, so now I wanna ‘kill’ the player if it hits an obstacle with the top side of the motorcycle and the question is How do I do this? I had an idea with creating the second collider on the top of the Rider which will check if it hits something and then kill the player but I think it’s really complicated and it will cause some weird bugs when you accidentally touch the surface in mid-air with this collider, so is there any possibility to make this through the script? I hope someone can help me with that.

  • Liked by
Reply
1 on January 21, 2018

Any ideas? 

on January 23, 2018

Hi strangeOwl I’ve seen youve been pretty active on this forum. I was wondering if you could help me with one of my problems as no one seems to be responding here is the link: http://forum.brackeys.com/thread/rpg-help-example-scene-does-not-want-to-load/

I know i know, I’m riding on the guy who posted this threads back, but Im running out of patience. I have tried everything ( when I mean everything, I really mean continously mess around and inspect the scripts and such for a couple of hours until depression hits ) that I could possibly do and searched dozens of forums ( including this one ) to try and find an answer, but ive come up dry.

 

Please Obi wan kenobi, I need your help.

Show more replies
  • Liked by
Reply
Cancel
1 on January 21, 2018

You can just use a box collider for this, just place it carefully on the right place and it won’t cause any problems that I can think of right now

 

on January 23, 2018

Thank you 

Show more replies
  • Liked by
Reply
Cancel
4 on January 23, 2018

I agree with bennie3211,
you could use a box collider on the top (with isTrigger checked).

Otherwise you could use a script where you check whether the bike is on the ground and upside down 😉

on January 23, 2018

Yeah, I know about the box collider, but I wanted to do this through script for self-improvement in programming. Also, how do I check if the bike is upside down (I thought about checking the rotation, but it’s too simple to be true 😀 )

on January 23, 2018

Check the rotation and if the object is on the ground (you can use OnCollisionEnter, please dont judge me if the name is incorrect, just search for “unity check if object is grounded“) 😉

on January 23, 2018

Got it, thanks a lot! 

on January 23, 2018

No problem 😉

Show more replies
  • Liked by
Reply
Cancel
0 on January 27, 2018

how did u do it i still cannt :/

  • Liked by
Reply
Cancel
0 on January 27, 2018
  • Liked by
Reply
Cancel
1 on February 10, 2018

I am a noob. I am trying to so the same step as Brackey did in the Rider tutorial but after importing the Bezier curver package, I am getting below error. Please help.

Assets/BezierCurveLines/Scripts/BezierCurveCollider2D.cs(126,8): error CS1061: Type `UnityEngine.LineRenderer’ does not contain a definition for `positionCount’ and no extension method `positionCount’ of type `UnityEngine.LineRenderer’ could be found. Are you missing an assembly reference?

on February 10, 2018

I have no idea man, I imported the asset and everything went great, so I’m not the person who can help, sorry, I hope someone will tell you how to fix it

Show more replies
  • Liked by
Reply
Cancel
0 on February 10, 2018

Hey guys, I am a few days ahead of you it seems in this project so here is what I can help with!!

I have this code in the “CarController” script: https://pastebin.com/8TgFzpT3 which basically just checks the position of the rider and if the position is less than the value and the rider is grounded, there is an explosion sound and the level restarts.  

https://pastebin.com/qMrpj18u

Here is a paste of the “GameManager” script so you can see what the EndGame() method does as well.  You don’t need to worry about the “deathSoundHasPlayed” variable unless you’re trying to add sound.

Then just make sure you add a script component to whatever object is your finish line, I just used Brackeys’ “EndTrigger” Script:  https://pastebin.com/mKXd31uC then drag that into the script slot of your finish line and make sure the “GameManager” is dragged into the game manager slot as well.

Hopefully this helps, TBH I’m pretty new to this all as well but if you have questions or need clarification I can try my best!

P.S. There is a bug with my system, a major one as well!  I’ll let you try and find what the bug is, shouldn’t take you too long!  However, this will get you at least started hopefully!

P.S.S. If you find a way around this bug definitely let me know because I’ve just moved on for now to come back to it later! 🙂 😉

  • Liked by
Reply
Cancel