A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Julio Jerez » Wed Jun 30, 2010 11:42 am
teh body must be on teh negative side of teh plane equation for the bouynacy to be felt.
you can call GetForce after you apply the buoyance force to see if a force was added to the body.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by coimbra79 » Wed Jun 30, 2010 12:53 pm
edited!
naturally my 3dEngine (coiAxis*) provides to recopy matrix from NGD to OGL for video output (i omitted relative code in reply)
I can't wait for try your tip!
Last edited by
coimbra79 on Wed Jun 30, 2010 1:24 pm, edited 1 time in total.
-

coimbra79
-
- Posts: 42
- Joined: Sun Jun 27, 2010 1:39 pm
by Julio Jerez » Wed Jun 30, 2010 1:04 pm
I did not get that.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by coimbra79 » Wed Jun 30, 2010 8:11 pm
...
i cant build in vb6 the buoyancyPlane callback for parameter in NewtonBodyAddBuoyancyForce
- Code: Select all
NewtonBodyAddBuoyancyForce ngdInscr.NewtonBody, 0.8, 0.8, 0.8, Gravity.xyzw(0), AddressOf eqPiano, vbNull
this is into Newtoncallback_Module
- Code: Select all
Public Function eqPiano(collisionID As Long, ByVal context As Long, globalSpaceMatrix() As Single, globalSpacePlane() As Single) As Long
globalSpacePlane(0) = 0
globalSpacePlane(1) = 1
globalSpacePlane(2) = 0
globalSpacePlane(3) = 1 'body falls by higer
eqPiano = 1 'return 1
End Function
application crashes critically with an error of array out of range, if i tray infact, to debug for array uboud of globalSpacePlane receive -1 as result, this means the array have dimension = 0

why it happen


are some prerequisite i'm missing

buoyancy must be applyed to all object that'll be immerse into fluid or even just to fluid

sorry but for me is very hard translate fom yours c+ saples to my vb6

-

coimbra79
-
- Posts: 42
- Joined: Sun Jun 27, 2010 1:39 pm
by coimbra79 » Thu Jul 01, 2010 6:28 pm
Julio Jerez wrote:you can see i fteh Buoyancy force was added by calling GetForce after the call to apply bouyancy force.
u must also update NW before call getforce
-

coimbra79
-
- Posts: 42
- Joined: Sun Jun 27, 2010 1:39 pm
by coimbra79 » Thu Jul 01, 2010 6:55 pm
finally i solved...
bouyancy was not applyed to my bodies only because addbouyancy was not called into ForceAndTorqueCallback, in where i assigned instead only gforce.
inserting bouyancy addforce function int callback it work exactly
I lost a lot of my time because passed null values to ADDBOUYANCY using the vb6 global variable 'vbNull', it is wrong!!! right parameter is '0&'
uncorrect
NewtonBodyAddBuoyancyForce body, 0.8, 0.8, 0.8, Force.xyz(0), vbNull, body
correct
NewtonBodyAddBuoyancyForce body, 0.8, 0.8, 0.8, Force.xyz(0), 0&, body
tanks!
I'm adding phisics concept to my 3dEngine using power of NewtonGameDynamics. My engine, i named 'coiAxis*', is completely wrote in VB6 using OGL Api. All about NewtonGameDynamics, i allready understood, ll be happy to explain and share code, if your language is VB6
coimbra79 NewtonBodyAddBuoyancyForce SOLVED!
-

coimbra79
-
- Posts: 42
- Joined: Sun Jun 27, 2010 1:39 pm
by coimbra79 » Fri Jul 02, 2010 6:08 am
...
wath is the way to assign a box-volume as if it is fluid?
eg.

objs1 - are living normally into NW, infact they'r living in positive side of liquid surface (grey line)
objs2 - are totally or partly immersed into liquid, so they respect archimedean
objs3 - are living normally into NW, despite they'r living into negative part of liquid suface plane,
anyhow they are surely out by box-volume (azure-box)
is it possible ?
-

coimbra79
-
- Posts: 42
- Joined: Sun Jun 27, 2010 1:39 pm
by Julio Jerez » Fri Jul 02, 2010 7:30 am
if you are refering to hwo to know if the teh boyancy soudl be apply whn eth body is on teh side o fteh fliud plane but outside the volume, you sodul use a trigger volume.
see bouyancy demo in the SDK. It does just that
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by coimbra79 » Sat Jul 03, 2010 7:11 am
i'm reading in newton wiki in section 'parameters'
NewtonGetBuoyancyPlane *buoyancyPlane - pointer to an array of at least 4 floats containing the plane equation of the surface of the fluid. This parameter can be NULL ...well, so can i pass into this parameter only the plane equation without using callback?
eg:
- Code: Select all
'global space plane equation
gspe(0) = 0
gspe(1) = 1
gspe(2) = 0
gspe(3) = -1
'adding archimedean
NewtonBodyAddBuoyancyForce body, 0.8, 0.3, 0.3, gv(0), gspe(0), 0&
and if is yes, wath the right way?
trying by myself this code i receive as result, the same result i get passing null value instead gspe()
tank 4 be patient
-

coimbra79
-
- Posts: 42
- Joined: Sun Jun 27, 2010 1:39 pm
by Julio Jerez » Sat Jul 03, 2010 2:09 pm
if you pass NULL then the whole body is considered immerse in the fluid.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by coimbra79 » Sat Jul 03, 2010 8:02 pm
Julio Jerez wrote:if you pass NULL then the whole body is considered immerse in the fluid.
if i pass plane equation without use callback, like in code, the whole body is considered immerse in the fluid equally...
Wy?
-

coimbra79
-
- Posts: 42
- Joined: Sun Jun 27, 2010 1:39 pm
by rvangaal » Mon Aug 20, 2012 8:19 am
(it's an old thread, but still useful)
@Coimbra79: if you wonder why you would ever pass 0 as the plane (whole body under water): this is useful to skip calculating the volume of the immersed object. If for example the bounding volume (sphere/AABB) of your floating object is entirely below the plane, it's faster to skip the volume calculation (the bounding volume check should be simple & fast).
My question is: what are typical values for fluid density and viscosity. I can imagine viscosity to range from 0 (free) to 1 (extremely sticky), but density; 1000 seems a scientific value (at 4 degrees really ~999), but is that a good value to use? It seems with a testbox here, a value of around 40 seems to work better.
And the gravity vector, is that a direction (unit vector) or a force (including mass)?
*edit* Question 3: On Sacha Willems' page (Newton in Pascal) I see that the regular gravity force (F=-g*m) is totally omitted if the object hits the water. Does NewtonBodyAddBuoyancyForce() include gravity effects directly? (and in that case I should omit adding an explicit gravity force)
-
rvangaal
-
- Posts: 61
- Joined: Mon Jun 08, 2009 1:11 pm
by Julio Jerez » Mon Aug 20, 2012 9:11 am
the gravity must be added, the eassies way si to chain force and torque callback liek virtual function of a class
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 4 guests