![]() |
Never mind, it seems to be working on.
it was a problem when turning left with the angle going minus that was stuffing it. I just set the start angle and it works fine now. Now all I need to do is the characters head and im done. |
I now have the cars rotation, player head rotation and now reversing.
Any idea's one how I could make something so if it hit a wall it would bounce back? Well I know the bounce back bit. In my script I have on a timeout if the speed is less than zero that it will slowly stop.. But how would the wall checks work for something like this? the most complex part I know is if(onwall(x, y)){ Pretty sad eh? To clarify it up for anyone that doesn't understand. I am wondering how I could make something caculate if there is a wall I front of you and bounce you back. How would you get all the on wall checks to work ^_~ |
Use the same math you're using to move the car to check if that x, y position is on a wall. If it is then 'bounce back'.
|
You can invert the angle easily by doing
invertedangle=(angle+pi)%(pi*2) as for the power, I would subtract a little from the initial collision. Then use the same direction formula you have already been given. |
Thanks for the help, il get started on the collision checking when I get home.
|
Quote:
|
Quote:
|
I know how to detect if there on a wall, but how would I handle it?
I have tried reversing the players movement which is this. PHP Code:
I think I'm in way over my head. |
Quote:
|
Quote:
Quote:
Also for those who don't know % is the mod operator. It works by spitting out the remainder of 2 given numbers. Eg:6%4=2, 6%5=1, 11%10=1 |
Update: I now have collision detection and it works.
Next up: When you fire the weapon it should put you in the car, when you press A it should place a NPC of the car on the map and allow you to press A next to it to enter. @Everyone Thanks for all your help |
| All times are GMT +2. The time now is 06:00 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.