[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Thread Index]
[Monthly Archives] [List Home]

RE: [Virtools] FW: Help on Physics Car



Hello,

Solution 3:
Create a curve along the track, make a 3dframe follow the curve and
control (Motion Controller) the car (physicalized) with the 3dframe.
The control has to take place at the front of the car. To allow for
this, change the chassis's ref or  constrained a physicalized object
to the chassis and control the object.

Best regards,

Christian Garnier.

-----Message d'origine-----
De : owner-virtools-user-group@lists.theswapmeet.com
[mailto:owner-virtools-user-group@lists.theswapmeet.com]De la part de
Araya
Envoyé : mardi 21 janvier 2003 13:07
Ą : Joćo Batalha; virtools-user-group@lists.theswapmeet.com
Objet : Re: [Virtools] FW: Help on Physics Car


Hi Joao,

There's several way to do it:

Solution 1:
=======

Fast result without AI programming or scripting.

Step 1.
Add a script to your car that records the car motions during one or several
laps. To do so, use the "Animation Recorder" building block to generate the
animation.
Step 2.
Once you have your animation created, you can deactivate (or even destroy)
this script as well as the physics car script (the script you use to control
the car).
Step 3.
Create a script on the opponent to make it play the created animation. To do
so, simply use the "Play Animation" building block (or "Play Global
Animation" if your animation contains the wheels motion).
Step 4.
Now, in order to get this moving opponent be like an obstacle to you, you
need to physicalize it. To do so, use the "Physicalize" building block (you
should give a simplier topology in order for the moving car to encapsulate
the wheels... try first with a simple box topology). Then use the "Motion
Controller" building block to get this box follow the opponent car's
orientation and position (beware with parameters... use damping but not too
much, and tune the forces so your car won't be ejected if it collide with
the opponent).
Obviously, this box is intended to be hidden.

Issues with this method:
The opponents reaction is very human-like, but is always the same. As a
consequence, Your car cannot push them out (which is maybe not what you
want)
If you use wheels tracks, you'll have to simulate them in another way, or
even to forget this feature for the opponents.
Same goes for wheels skidding sound.
To make them react a little bit more interactively, you can detect if your
car is just in front of one of them, an so reduce the animation speed of the
opponent (use "Set Animation Step" building block in this case instead of
"Play Animation").


Solution 2:
=======

This solution is more physically correct but is also more time consuming,
and harder to create.
Apply the "Physics Car" building block on each opponents, but instead of
using the building block "Swicth On Key" to activate the input of "Physics
Car" you can create your own AI behavior (with scripts or c++ coded building
block) which output are the same than "Swicth On Key".
One possible AI algorithm would be:
Step 1.
Create a hidden geometry like a tube that folows the track of the race.
Step 2.
Use the "RayCast" building block (is the real name.. ?) to provide a easy
forward test in front of your car (use the car position as the ray starting
point, and the car Z vector as the direction).
Step 3.
Make the raycast length proportionnal to the car's speed.
Step 4.
If the ray doesn't cast any a wall of the hidden tube (or the bounding box
of other opponents), then just continue accelerating.
If the ray casts a wall of the hidden tube (or the bounding box of other
opponents), then compute those 3 parameters:
- distanceToWall: distance from the car's position to the intersection point
with the wall.
- wallSteeringInfluence: scalar product between the normalized wall normal,
and the car's X axis.
- wallBrakeInfluence: scaler product between the normalized wall normal, and
the car's Z axis.
Step 5.
Combine those three variables in order to control your opponent's wheels
steering (whether binaries steering, or analogical steering), and opponent's
speed.
Ex: The smaller distanceToWall is the greater your brake will be. The
greater wallBrakeInfluence is the greater your brake will be. And finally
turn left or right proportionnaly to wallSteeringInfluence.


Those are just ideas, and can't result in the final perfect solution, but at
least it should gives you some hints.

Hope this help,

Araya

( by the way... VIVA PORTUGAL ! )



----- Original Message -----
From: "Joćo Batalha" <joao.batalha@ydreams.com>
To: <virtools-user-group@lists.theswapmeet.com>
Sent: Monday, January 20, 2003 8:00 PM
Subject: [Virtools] FW: Help on Physics Car


>
>
>
> Hi, people:
>
> I making a little formula 1 game in Virtools.
> Does anyone have any idea how to put formula 1 car racing on a track
> controlled by the computer but with physics car applied to all?
>
>  Thanks anyway
>
> Joao
>
> ...............................................................
> Distributed via the virtools-user-group list:
http://www.theswapmeet.com/numl.html
> To reply to the list instead of its author, use "Reply to All"
> To unsubscribe: send "unsubscribe virtools-user-group" to
Majordomo@lists.theswapmeet.com
> To subscribe: send "subscribe virtools-user-group" to
Majordomo@lists.theswapmeet.com
> To post a message: send it to virtools-user-group@lists.theswapmeet.com
> ...............................................................
>

...............................................................
Distributed via the virtools-user-group list:
http://www.theswapmeet.com/numl.html
To reply to the list instead of its author, use "Reply to All"
To unsubscribe: send "unsubscribe virtools-user-group" to
Majordomo@lists.theswapmeet.com
To subscribe: send "subscribe virtools-user-group" to
Majordomo@lists.theswapmeet.com
To post a message: send it to virtools-user-group@lists.theswapmeet.com
...............................................................

...............................................................
Distributed via the virtools-user-group list: http://www.theswapmeet.com/numl.html
To reply to the list instead of its author, use "Reply to All"
To unsubscribe: send "unsubscribe virtools-user-group" to Majordomo@lists.theswapmeet.com
To subscribe: send "subscribe virtools-user-group" to Majordomo@lists.theswapmeet.com
To post a message: send it to virtools-user-group@lists.theswapmeet.com
...............................................................


References: