Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Moving around+Collision  (Read 1306 times)
Skellods
Community Member
*
Posts: 10


WWW
« on: January 30, 2011, 05:06:08 PM »

Hello TV3D community,
I'm currently working on my game physics. I use Engine 6.5 with Newton. Physics work fine. There is only one problem.
I control a node with WASD. An actor body follows this node (via set position). An actor is bound to the body. So when I move the node, the actor will also move. I test collision with newton when I move the node. So, I move the node, test for a collision, if there is one, a variable is changed. If the variable is already changed, I reset it and move the node back to the position of the first collision detection. I can go around and move some static meshes. But it doesn't look good (the meshes vibrate while I run against them -.-). And they barely move. But I want that it's smoothe and that I can move those meshes when I run against them (by the way, I use boxes as meshes). They should be kicked away when I run with full speed against them and only move a little when I "touch" them. Any ideas?
Logged

Skellods
Community Member
*
Posts: 10


WWW
« Reply #1 on: January 30, 2011, 05:49:15 PM »

lol, ok, problem solved. If you want to know how I did it:
When I reset the actor position I add an impuls to the mesh. Just use sth like this:

Code:
physic.AddImpulse([mesh],Globals.Vector3(physic.GetBodyPosition([mesh]).x-physic.GetBodyPosition([actor]).x,physic.GetBodyPosition([mesh]).y-physic.GetBodyPosition([actor]).y,physic.GetBodyPosition([mesh]).z-physic.GetBodyPosition([actor]).z),false);

and replace [mesh] with the right mesh and [actor] with your main character. I think this thing is really great. With this line you can kick everything around^^

Note: You have to get the right mesh via collision tests.
« Last Edit: January 31, 2011, 07:12:59 AM by Skellods » Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks