Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Di Mai 14, 2024 13:01

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 16 Beiträge ]  Gehe zu Seite 1, 2  Nächste
Autor Nachricht
 Betreff des Beitrags: glNewtonSceneBSP
BeitragVerfasst: Di Dez 28, 2004 16:16 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Note: glNewtonSceneBSP is is a merging of Sascha Willems's glNewtonScene3DS, glNewtonRagdoll and Jan Horns BSP Demo.

I can't get the ball to collide with the BSP world, im guessing where the bsp is rendered is different to where the collision thing is..... source attached.

To get the demo to run u need the following files

glNewtonScene3DS:
Newton.dll
data directory

Q3BSPbasic:
maps directory
textures directory


Dateianhänge:
glNewtonSceneBSP.zip [106.79 KiB]
283-mal heruntergeladen

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu
Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Dez 28, 2004 17:00 
Offline
DGL Member
Benutzeravatar

Registriert: Mo Sep 23, 2002 19:27
Beiträge: 5812
Programmiersprache: C++
Please use newton's debug output features (see my demos, the vehicle one has them) to let you show the actual collision geometry. This way you can easily say if the collider is at the right position.

_________________
www.SaschaWillems.de | GitHub | Twitter | GPU Datenbanken (Vulkan, GL, GLES)


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Dez 28, 2004 18:07 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
well... after implementing ur collision showing thingy the program just hangs and no frames are ever rendered.....


Dateianhänge:
glNewtonSceneBSP.zip [107.2 KiB]
271-mal heruntergeladen

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu
Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Dez 28, 2004 23:05 
Offline
DGL Member
Benutzeravatar

Registriert: Mo Sep 23, 2002 19:27
Beiträge: 5812
Programmiersprache: C++
What Newton-DLL were you using (since you didn't include it)? I've put one in the directory (size = 368 KBytes) but the project gives ma an access violation (even after commenting out the debug stuff).

_________________
www.SaschaWillems.de | GitHub | Twitter | GPU Datenbanken (Vulkan, GL, GLES)


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Dez 28, 2004 23:22 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
the one with glNewtonScene3ds(im guessing v1.2), since the new one wouldn't work and since i know vertualy nothing on newton, i have no clue what was changed(in the new dll) to cause this.

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Dez 29, 2004 10:24 
Offline
DGL Member
Benutzeravatar

Registriert: Mo Sep 23, 2002 19:27
Beiträge: 5812
Programmiersprache: C++
I guess that's why debug didn't work. I've just went through the sources and saw that you removed the cdecl behind the debug callback, so that can't work. If I remember correct. that was a wrong declaration in the old newton header itself, so it's not your fault. I'll update the demo to the newest newton version (1.3) and upload it. I'll also mark what I've changed in the source so that you can easily follow on what has changed.

Edit : I was correcting your sources, but there are so many errors in it that I'd take me some longer, so I don't know when I'll have the time (and motivation) to correct it. One of your biggest faults is the fact that you haven't taken into account that Q3-Faces are normally NOT only triangles, but of any shape. But when building the collision tree, you only overgive the faces as triangles which is totally wrong. So if you fix that, it may work.

_________________
www.SaschaWillems.de | GitHub | Twitter | GPU Datenbanken (Vulkan, GL, GLES)


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Dez 29, 2004 16:44 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
EDITED: seems like it does have more than 3 points per face......

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Zuletzt geändert von Stucuk am Mi Dez 29, 2004 16:57, insgesamt 1-mal geändert.

Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Dez 29, 2004 16:50 
Offline
DGL Member
Benutzeravatar

Registriert: Mo Sep 23, 2002 19:27
Beiträge: 5812
Programmiersprache: C++
And that's what I said : A trianglefan is not a triangle. In your code for building the tree collision, you always only use three vertices of a face. That's wrong, as some faces have more triangles (to build the triangle strip), and newton needs all those vertices to build collision data. After doing it that way, I at least see the correct collision data.

_________________
www.SaschaWillems.de | GitHub | Twitter | GPU Datenbanken (Vulkan, GL, GLES)


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mi Dez 29, 2004 17:10 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Code:
  1.  
  2. procedure CreateBSPCollisionTree(const pSceneBSP : TQuake3BSP);
  3. var
  4.  TmpFace : array[0..20] of TVector3f;
  5.  TmpM    : TMatrix4f;
  6.  Min     : TVector3f;
  7.  Max     : TVector3f;
  8.  m,f     : Integer;
  9. begin
  10. CollTreeBSP := NewtonCreateTreeCollision(NewtonWorld, nil);
  11. // Go through all meshes and add the faces of it to the tree collision
  12. NewtonTreeCollisionBeginBuild(CollTreeBSP);
  13. if pSceneBSP.numOfFaces > 0 then
  14.    for f := 0 to pSceneBSP.numOfFaces-1 do
  15.    If pSceneBSP.Faces[f].FaceType = 1 then
  16.      begin
  17.      for m := 0 to pSceneBSP.Faces[f].numOfVerts-1 do
  18.      TmpFace[m] := pSceneBSP.Vertices[pSceneBSP.Faces[f].startVertIndex+m].Position;
  19.  
  20.      NewtonTreeCollisionAddFace(CollTreeBSP, m, @TmpFace[0], SizeOf(TVector3f), 1);
  21.      end;
  22.  
  23. NewtonTreeCollisionEndBuild(CollTreeBSP, 0);
  24. BodyBSP := NewtonCreateBody(NewtonWorld, CollTreeBSP);
  25. // Set position to 0/0/0
  26. Matrix_SetIdentity(TmpM);
  27. NewtonBodySetMatrix(BodyBSP, @TmpM[0,0]);
  28. // Set material
  29. NewtonBodySetMaterialGroupID(BodyBSP, MatWorld);
  30. // Get AABB and set limits of the newton world
  31. NewtonCollisionCalculateAABB(CollTreeBSP, @TmpM[0,0], @Min, @Max);
  32. NewtonSetWorldSize(NewtonWorld, @Min, @Max);
  33. NewtonReleaseCollision(NewtonWorld, CollTreeBSP);
  34. end;
  35.  


the only face that seems to have collision is the ceiling...... everything else the ball goes through.

To make the ball spawn above the ceiling:
Code:
  1. Matrix_SetTransform(BallMatrix, V4(-5,800,2));


EDIT: does the order u supply the vertex's in change anything? i.e with rendering it determins which side is visible (well with cull)

Code:
  1. Matrix_SetTransform(BallMatrix, V4(160,500,100));


the ball goes through the top of the box, and collides with the bottom...

EDIT2: reversing the order of the faces doesn't work, stops the box in the corner from having any collision.

EDIT3: above edit is wrong (made an error int he code), the collision thing should be the following (note: not all the faces have collisions, iv only noticed the roof and the box in the corner having collision):

Code:
  1.  
  2. procedure CreateBSPCollisionTree(const pSceneBSP : TQuake3BSP);
  3. var
  4.  TmpFace : array[0..20] of TVector3f;
  5.  TmpM    : TMatrix4f;
  6.  Min     : TVector3f;
  7.  Max     : TVector3f;
  8.  m,f     : Integer;
  9. begin
  10. CollTreeBSP := NewtonCreateTreeCollision(NewtonWorld, nil);
  11. // Go through all meshes and add the faces of it to the tree collision
  12. NewtonTreeCollisionBeginBuild(CollTreeBSP);
  13. if pSceneBSP.numOfFaces > 0 then
  14.    for f := 0 to pSceneBSP.numOfFaces-1 do
  15.    If pSceneBSP.Faces[f].FaceType = 1 then
  16.      begin
  17.      for m := 0 to pSceneBSP.Faces[f].numOfVerts-1 do
  18.      TmpFace[m] := pSceneBSP.Vertices[pSceneBSP.Faces[f].startVertIndex+(pSceneBSP.Faces[f].numOfVerts-1-m)].Position;
  19.  
  20.      NewtonTreeCollisionAddFace(CollTreeBSP, m, @TmpFace[0], SizeOf(TVector3f), 1);
  21.      end;
  22.  
  23. NewtonTreeCollisionEndBuild(CollTreeBSP, 0);
  24. BodyBSP := NewtonCreateBody(NewtonWorld, CollTreeBSP);
  25. // Set position to 0/0/0
  26. Matrix_SetIdentity(TmpM);
  27. NewtonBodySetMatrix(BodyBSP, @TmpM[0,0]);
  28. // Set material
  29. NewtonBodySetMaterialGroupID(BodyBSP, MatWorld);
  30. // Get AABB and set limits of the newton world
  31. NewtonCollisionCalculateAABB(CollTreeBSP, @TmpM[0,0], @Min, @Max);
  32. NewtonSetWorldSize(NewtonWorld, @Min, @Max);
  33. NewtonReleaseCollision(NewtonWorld, CollTreeBSP);
  34. end;
  35.  


EDIT4: last edit did it, the problem was that the size of the ball was too small for the world (if im correct sometimes it had to much downward force for its size, so it jumped past the collision bit since it was so small. Increasing its size fixed the prob.).

What do i need to modify to make the ball move faster?


Dateianhänge:
Dateikommentar: Collision now works!
glNewtonSceneBSP.zip [107.21 KiB]
281-mal heruntergeladen

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu
Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Dez 30, 2004 03:24 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Do you know what the face atribs of NewtonTreeCollisionAddFace are? (i can't seem to find any documentation on Newton..... only got about 6 results in google with the term NewtonTreeCollisionAddFace.....)

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Dez 30, 2004 10:13 
Offline
DGL Member
Benutzeravatar

Registriert: Mo Sep 23, 2002 19:27
Beiträge: 5812
Programmiersprache: C++
I guess you mean the last parameter. For newton it does nothing usefull, but you can use it to identify for example the material of a certain face in a callback and then decide what material settings to use for that face. I do that in my car demo, where e.g. the grass triangles of the scene have a different material than the ice triangles. Now in the collision callback with the tyres, I can check wether the tire collided with ice or grass and override the default material settings.

And as for the ball passing through : Since newon doesn't do (yet) substeps, it may help to set a higher simulation for the physics simulation. The default for NewtonSetMinimumFrameRate ist 60, so you may set that value higher (try something like 300) and it may work then.

And making newton faster : Just make the timestep you set in NewtonUpdate bigger (note that newton clamps certain values that are below min and max threshold). Or try to implement accumulative timestepping for physics simulation, that way you always have correct physics behaviour (the QPC-thinggy won't always work) and can set the speed of your physics by hand. I now also use that in all my demos and it's the best way to go about physics timing.

_________________
www.SaschaWillems.de | GitHub | Twitter | GPU Datenbanken (Vulkan, GL, GLES)


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Dez 30, 2004 15:59 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Zitat:
What do i need to modify to make the ball move faster?


I ment when the user presses the cursor keys. Im guessing id ned to do something with the following:

Code:
  1.  
  2. Torque := V3(TorqueDir.x*(Ixx*75) - TorqueDir.x*(2*Ixx*TmpS),
  3.              TorqueDir.y*(Ixx*75) - TorqueDir.y*(2*Ixx*TmpS),
  4.              TorqueDir.z*(Ixx*75) - TorqueDir.z*(2*Ixx*TmpS));
  5.  


Latest Source(Includes all files): -Download(700kb)

Im guessing its ok to include ur sphere texture (u only said not to distriburte the sky tex in the readme).

P.S to incorperate ur boyancy demo into the mix would the code need to be updated to the latest dll, or do u think it would work fine with 1.2(i think)


Dateianhänge:
loading.jpg
loading.jpg [ 69.81 KiB | 7261-mal betrachtet ]

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu
Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Nice work
BeitragVerfasst: Do Dez 30, 2004 22:06 
Hi Stucuk and Sascha Willems

You made a very nice work with glNewtonSceneBSP
I'm able tocompile it. The only probleme is when i try to run it via Delphi
Thats give me a error

Project glNewtonSceneBSP.exe raised exception class c0000005 with message 'access violation at 0x1000241f read of address 0x00000000.

and if i go at the address 1000241f (Search->Find Error) the error are located in Newton.NewtonBodyGetMartix

But if i try to direct execute glNewtonSceneBSP.exe everything work ok

Anyway good work :P
Stucuk and Sascha Willems do you have Msg or ICQ i need to communicate with you direcly.

WarLock


Nach oben
  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Dez 30, 2004 22:54 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
MSN: Stuc_uk_2000 at hotmail.com (its at the bottom of my posts, the msnm button thing)

Zitat:
I'm able tocompile it. The only probleme is when i try to run it via Delphi
Thats give me a error


It will(i think, not having a german version i can't tell :P) be the decimal point error germans have.... forgot about it....

- Download

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Do Dez 30, 2004 22:57 
I'm testing your glNewtonSceneBSP demo and it's is what hi see

Your not using the latest version of Newton Header and Dll
So i decide to try to test it with the latest version

Download the latest header: http://newton.delphigl.de/newtonimport.zip
Download the latest Newton dll : http://www.delphigl.de/files/newtonplayground.zip ( in the Newton Playground demo of Sascha Willems )

Also you need to change smal thing to be able to compile

replace
Code:
  1. DollBone := NewtonRagDollAddBone(pRagDoll, pParentDollBone, nil, 10, @Matrix[0] , @Size);

by
Code:
  1. DollBone := NewtonRagDollAddBone(pRagDoll, pParentDollBone, nil, 10, @Matrix[0] ,nil , @Size);


and
Code:
  1. Collider := NewtonCreateSphere(NewtonWorld, 10, nil);

by
Code:
  1. Collider := NewtonCreateSphere(NewtonWorld, 10, 0, 0 ,nil); // Not sure to set the radiusY and radiusZ to 0 or 10


After that everything compile but crash when executing.
The error are located in Newton.NewtonBodyGetMartix again

i'm interested in this demo like you can see and looking for a fix :wink:

WarLock


Nach oben
  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 16 Beiträge ]  Gehe zu Seite 1, 2  Nächste
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 4 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.032s | 19 Queries | GZIP : On ]