Bonjour, your English is great
I really think you should try what I explain in the other post
But, the way to do what you’re asking is fortunately very easy … .just like this …
just cast rays down, where the yellow Xs are … you see ?
Simply start where the car is, and go forward (say 5 or 10 degrees at a time) around the imaginary circle.
You need only go say 100 degrees, and you are done, you can then drive.
Do not hesitate to ask any further questions !!!
“However do I have to determine to position of the yellow Xs?”
Of course, it’s only one line of code. Just use Mathf (see doco) for sine, cosine, etc.
An even better way to do it:
just make a “calculation” mechanism (ie, an empty game object) and sit it at the center of the circle.
Have a marker (“mmm”) that sticks out the correct distance. Simply rotate this “calculation” object, by ten degrees at a time.
Just shoot from “mmm” - it saves you doing the high-school math!
:The solution I just thought of was instantiating a gameobject at the center of the red circle and having a cube rotating around the gameobject with the radius as the distance to see if the cube would detect a collision. However if I could get your solution to work, then it would be better for the performance:"
You are truly thinking like a game programmer. Your life is set!
there are problems with that idea, it takes time! You have to swing it around!!!
Regarding the raycasts, you can do a few zillion of them all inside one frame you know?
Note too that you can be a smart-arse with a “hoop” that is on an ANGLE … move it down, and the POINT of contact is like the exact first point if moving around, you know?
If you were going to do your “swinging invisible tester” … do not forget too that …
YOU COULD SIMPLY MOVE THE CAR !!! heh! it is everyday ion game engines that you take an invisible version of an actor, and you “move it ahead” to see what it can do. You know?
(For this, you must learn about the LAYERS system in Unity3D … you know it? it’s great, read up)
But these things are not relevant here…
I would perhaps, suggest, encourage you to do “ray casting along a possible path” as it is an extremely common technique, it is everyday.
(Do not forget, it may not be the red circle … God knows, you may be trying a future path in a straight line, or all sorts of things … ideally, you construct yourself a little OO object that will be useful to you generally !!!)
Note that you might have to try four or five attempted radii, each with a few raycasts … it will take you maybe 30 raycasts … you will do a kind of “binary search” through the space back and fore to find a nice path, I guess.
One small point: “it would be better for the performance”… not true, PjhysX is incredibly efficient AND it’s always very hard IMO to guess what will be faster. Often it is counter intuitive. It could be that what we mention “swing a cat” is much quicker than what we mention “ten yellow shots” - it is really hard to say. Based on experience both are “absolutely no problem” – just go right ahead and do not think one atom about performance at this point,
Hope it helps in some way
Sol one day someone will say my drawings are good, I still wait …
PS you know this right: on the track you have drawn…
You could PRECALCULATE, like today, now, the solution for say 10 entry positions across, at 5 angles each, at 5 speeds each, you generate a space of maybe 1000 solutions. (so for each one it tells you “brake this much” or whatever), store it in some data.
So, this is definitely an approach you see being used. At run time (drive time?) just look up the closest and use it.
of course, it is more fun to have a car that works itself