Hovering using only AddForce and SetForce

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Hovering using only AddForce and SetForce

Postby Overhertz » Sat Nov 10, 2012 12:21 pm

Super thanks again, OK my final quest to get the test sandbox ready, currently the force callback for the kinematic body is static it just updates the force.y by 5 or whatever force i want to select, but I would like the force vector to be based on the rotation of the kinematic body, is there a simple way i can do this? Thanks again Julio.
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: Hovering using only AddForce and SetForce

Postby Julio Jerez » Sat Nov 10, 2012 12:50 pm

Overhertz wrote:currently the force callback for the kinematic body is static it just updates the force.y by 5 or whatever force i want to select, but I would like the force vector to be based on the rotation of the kinematic body, is there a simple way i can do this? Thanks again Julio.

what do you mean by that?
you need to calcuale a force and a torque.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hovering using only AddForce and SetForce

Postby Overhertz » Sat Nov 10, 2012 1:02 pm

Hello,

OK what i mean is that the rejection force right now only forces by the y axis, so when intersecting an object

rejectionforce = {0,5,0}, but if possible i'd like to make this change depending on the angle/rotation of the kinematic body, rejectionforce = 5 / rotation, so if the kinematic body is not exactly flat it will push slightly to the side, if you understand what i mean.

so rotatebasedonkinematcirotation( rejectionforce = {0,5,0} )
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: Hovering using only AddForce and SetForce

Postby Julio Jerez » Sat Nov 10, 2012 2:51 pm

do you know how forces apply at a point work?
bascally you need to add the conpcect of trusters to your vehicle, those are forces that act a a point in the vehicle, they generate force and torque.
look on the FAQ in this forum, there is an example of for to do that.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hovering using only AddForce and SetForce

Postby Overhertz » Sun Nov 11, 2012 11:34 am

OK i think i may have it working, but I'm having a problem with NewtonCreateBox and setting the facing direction of the matrix, i need to the forward direction to point up the y axis, i've tried to rotate the offset matrix but with no luck. Any ideas?
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: Hovering using only AddForce and SetForce

Postby Julio Jerez » Sun Nov 11, 2012 11:48 am

I am confused now, bacsue I do not know what you are using.
are you using a single compound collision, or are you using a kinamatic body?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hovering using only AddForce and SetForce

Postby Overhertz » Sun Nov 11, 2012 11:58 am

lol sorry, I am using a kinematic body right now, since i solved the positioning of the kinematic body which is working very well, but the problem i have now is i need to add the force in the direction of the kinematic bodies forward direction

so i need to make a force vector , so force value of 5 needs to be rotated between the vector x, y, z based on the forward direction of the kinematic body (which needs to be set facing the y up axis on NewtonCreateBox)
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: Hovering using only AddForce and SetForce

Postby Julio Jerez » Sun Nov 11, 2012 12:35 pm

after you create the kinamtic body, you do not need to set the matrix of the shape you simple set the transform matrix o fteh kinematoc body.

I tell you what I can make a newton demo that make a hovercraft vehicle.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hovering using only AddForce and SetForce

Postby Overhertz » Sun Nov 11, 2012 12:36 pm

the hovering is working fine, but i am not trying to make just any hovering vehicle i am making a simulation that will allow the player to attach engines and so on to a body and fly or hover it around, i set the offset so the rotation will match the original body, all i need is that to be able to get the rotation / facing direction of the kinematic body.

I made a flv video of how it is working right now, which is exactly what i want, but again the problem is when the kinematic body is facing another direction the force is still +y, but i need it to vary the directional force.

video here

EDIT: I have now solved my problem, it is working great, but i have ran into another problem, is it possible in newton to rotate a cube using forces? or it needs to be done manually via setmatrix?
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: Hovering using only AddForce and SetForce

Postby Overhertz » Tue Nov 13, 2012 12:35 pm

Thought i would mention that i have also solved this problem :)
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: Hovering using only AddForce and SetForce

Postby Julio Jerez » Tue Nov 13, 2012 1:07 pm

Ha cool, I could watch the video, can you make one in avi, or mpeg so that I can see it?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hovering using only AddForce and SetForce

Postby Overhertz » Tue Nov 13, 2012 1:43 pm

Do you not have VLC installed? VLC will play flv files, as for AVI the file size would be very large, i converted that from 30mb file...

else i can do the next best thing, i have uploaded new test build HERE

First you will need to move the camera pretty close to the ground, and then press N, which will spawn a ship. I would also suggest to enable debug to help you control the ship with some visual reference, "`" and write "debug on"

Once it has stabilized over the ground you can then try to control it using the arrow keys, up for leaning forward, back to lean back, and sides etc, right now it is pretty difficult to control and there is no afterburner for moving forward, but u can do this with leaning.

My next task is to add AI stabilizers that will counter the forces to keep the ship upright in most circumstances. Also i need to work on the floatation as it bobs around a little too much from the force, but this i will correct easy soon :)

shot:

Image

let me know what you think so far.

ps: how long for mutlibody vehicles? :)
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Re: Hovering using only AddForce and SetForce

Postby Julio Jerez » Tue Nov 13, 2012 2:04 pm

I see the ship bobing up and down. I guess this is a start.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Hovering using only AddForce and SetForce

Postby Overhertz » Tue Nov 13, 2012 2:31 pm

Yes the bobbing is caused because i use a set rejectional force, but in reality what i need to do is an intersectional based force.

How would you suggest to get a total volume of the intersection between 2 bodies?
Ziron Programming Language
Download the Assembler HERE
User avatar
Overhertz
 
Posts: 112
Joined: Mon Jul 06, 2009 11:19 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests