- Forums
- Forum Help
- Search Forum
- Login
- Register
Truevision3D
>>
TV3D SDK
>>
TV3D SDK 6.5
(Moderators:
Waterman
,
Mithrandir_
,
beyonder
,
ZaPPZion
) >>
A physics engine question.
Pages: [
1
]
« previous
next »
Print
Author
Topic: A physics engine question. (Read 640 times)
nico2008
Community Member
Posts: 42
A physics engine question.
«
on:
July 29, 2011, 01:05:25 AM »
I want to make a man move in game and collide with box,
so I add box and man in the physics engine.
I use TVPhysics.SetBodyLinearVelocity() to make actor move forward,But his angle would change in the same time.
And when the angle is changing,I cant get the right direction for moving,
angle=TVP.GetBodyRotation(body).y
TVP.SetBodyPosition(body,x+10*Cos(angle),y,z+10*Sin(angle))
so the body will move for other direction.I dont know why the angle will change,and I cant get another way to achieve this goal.So help me.
Logged
asia
Customers
Community Member
Posts: 183
Re: A physics engine question.
«
Reply #1 on:
July 29, 2011, 08:32:50 AM »
Check the unit used for the angle. Did you mix up radiants and degrees?
The cos function works in radiants while, by default, the TV angles are in degrees.
Logged
Fabio Musmeci
ENEA
CR Casaccia
Via Anguillarese 301
00060 Rome
Italy
musmeci@enea.it
+39 3333934898
Learning to live better on a smaller footprint..
nico2008
Community Member
Posts: 42
Re: A physics engine question.
«
Reply #2 on:
July 29, 2011, 04:32:20 PM »
thanks for your reply.
I can sure the angle system is ok.
For example,the angle is 20,it will change between 18-22,not very big change,but it make model move in a wrong direction.
I hope u can personal test ,then tell me whether u suffer this situation。thanks
Logged
Mithrandir
Community Member
Posts: 325
Re: A physics engine question.
«
Reply #3 on:
July 30, 2011, 08:51:04 AM »
When you run the physics the position, rotation, velocities and external forces acting on a body are calculated by the engine. So if you just set the position you only move the body but the angular velocity keeps changing the rotation. Especially if you collide with the environments your body can start rolling around the obstacle thus changing Y angle. Render the physics debug meshes to see what's going on.
You could actually ignore the body Y rotation completly. Just use the rotation of the camera (which you change using mouse or otherwise) and use this angle to move the body around (instead of the body rotation).
Also, use forces and torques to move the body around. You will have to calculate the appropriate force to apply but you get all the benefits of the physics engine (collisions, interactions, gravity, etc). SetBodyPosition does not do any collision checking for you.
Logged
nico2008
Community Member
Posts: 42
Re: A physics engine question.
«
Reply #4 on:
July 30, 2011, 12:54:54 PM »
Great thanks to Mithrandir.I think I have a result for this problem.
The way your provided I think is enough to solve my problem,thX.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Truevision3D Official Information
-----------------------------
=> Development Information
-----------------------------
TV3D SDK
-----------------------------
=> TV3D SDK 6.3
===> Bugs
-----------------------------
Game Development
-----------------------------
=> Game Development
-----------------------------
Projects
-----------------------------
=> In-Development
=> Showcase
=> Recruitment
=> Announcements
-----------------------------
Truevision3D Official Information
-----------------------------
=> News and Announcements
-----------------------------
TV3D SDK
-----------------------------
=> TV3D SDK 6.5
-----------------------------
Game Development
-----------------------------
=> Engine Comparison
-----------------------------
TV3D SDK
-----------------------------
===> Shader Development
===> Content Pipeline
===> Bugs
-----------------------------
Game Development
-----------------------------
=> Companion Tools
=> Design and Theory
Powered by SMF 1.1.3
|
SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks