[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Car Logic
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 13
Thread images: 1
File: Car Movement.png (61 KB, 1775x590) Image search: [Google]
Car Movement.png
61 KB, 1775x590
Can someone help me with this vehicle Logic I am trying to do in Unity or give me some alternative to get me on the right track?

Basically I want this car to steer on the track without a pre-set waypoint-system on its own. At the moment I have two Rays to the sides(when the Ray on the right hits the bounds of the road it steers to the left and vice versa) and one longer Ray out the front that should tell the car to take a more steep curve when there is a curve ahead.(atleast that was the idea, apparently it doesnt work the way I imagined)

I drew this schematic diagram to clarify(or confuse you) even further.
>>
>>52111649

The picture should be a representation of what it is doing at the moment.
>>
Without waypoints, you're going to need some real-time full scene analysis to steer your cars, the kind that they do with physical robot cars. Why must your solution do without waypoints?
>>
>>52111737

I am generating the road as the car drives. I could generate waypoints with the road too(which I did at first) but for some reason it didnt work out the way it should. Maybe I will get back to the waypoints(static waypoint system no problem, but this went a bit over my head)
>>
>>52111831
Pathfinding for cars are a solved problem. I recommend reading the source code to an open source racing game.
>>
>>52111649
Unity users right there, or any modern game dev really. Can solve problems for shit.
>>
Do you want the car to hit the bounds or to follow the road? If it's the latter, your roads are probably defined with some sort of splines (Bezier curves, etc), right? Just use those. That gives you the position and derivative at all points (which will give the rotation of the car).
>>
>>52113543

The bezier curves the road follows are in pieces and not connected(and get put upfront the other pieces again when they are behind the car) Also I kinda thought some kind of steering logic thing with Rays could be less costly than constantly updating the waypoint-array and then having a steering logic ontop anyway.
>>
>>52113918
> I kinda thought some kind of steering logic thing with Rays could be less costly
It likely would, if it were possible the way you're trying to do it.
>>
>>52114013
Wouldn't it be as simple as casting a ray to the car's right and seeing the angle that hits the side of the road at and then steering so that that angle tries to be 90 degrees?
>>
http://www.red3d.com/cwr/steer/
>>
>>52114109

Yes you can get the direction of the normals your ray is hitting but the coordinates you get kinda dont relate to the player-vehicle(with a little bit of Vector math it probably would and translating from world space to local space or something)
>>
Well I ditched the whole Raycast thing and made a waypoint system.
Thread replies: 13
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.