Jump to content

Camera Collision


MrIslomaniac
 Share

Recommended Posts

Hey, it's me again.

I did some coding, but i don't seem to get any collision working:

TBody Spectator = CreateBodySphere(0.1f);
SetBodyMass(Spectator,1);
SetBodyGravityMode(Spectator,0);
PositionEntity(Spectator,EntityPosition(cam));
SetBodyDamping(Spectator,10.0);

EntityType(Spectator,1);
EntityType(game.scene.scene,1);

TBody Sphere = CreateBodySphere();
PositionEntity(Sphere,Vec3(0,50,0));
ScaleEntity(Sphere,Vec3(10,10,10));
EntityType(Sphere,1);
SetBodyGravityMode(Sphere,0);

Collisions::Set(1,1,SLIDINGCOLLISION);

In DebugPhysics, they just go through each other.

Any idea?

Link to comment
Share on other sites

Hey, it's me again.

I did some coding, but i don't seem to get any collision working:

TBody Spectator = CreateBodySphere(0.1f);
SetBodyMass(Spectator,1);
SetBodyGravityMode(Spectator,0);
PositionEntity(Spectator,EntityPosition(cam));
SetBodyDamping(Spectator,10.0);

EntityType(Spectator,1);
EntityType(game.scene.scene,1);

TBody Sphere = CreateBodySphere();
PositionEntity(Sphere,Vec3(0,50,0));
ScaleEntity(Sphere,Vec3(10,10,10));
EntityType(Sphere,1);
SetBodyGravityMode(Sphere,0);

Collisions::Set(1,1,SLIDINGCOLLISION);

In DebugPhysics, they just go through each other.

Any idea?

 

I am not a c++ guy, but I have some questions about your code. Is 'game.scene.scene' the actual entity you loaded with LoadScene()? Are you using lua inconjuction with c++? Have you tried just:

Collisions::Set(1,1,1);

just in case, SLIDINGCOLLISION is not being defined? Is the Spectator being parented to the cam?

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

spectator is not parented, i move the spectator and place the cam at the new position.

I am using gamelib, which complicates things even more(e.g. slidingcollision).

But i just figured it out myself =)

the scene does not react on physics, i don't know why, it just doesn't :P

So i created them by hand and it worked :P

 

TBody spectator=CreateBodySphere();
SetBodyMass(spectator,1);
SetBodyGravityMode(spectator,0);
EntityType(spectator,1);
SetBodyDamping(spectator,1.0);
::Collisions(1,1,1);

TBody Sphere = CreateBodySphere(0.3049625f);
EntityType(Sphere,1);
SetBodyGravityMode(Sphere,0);
SetBodyMass(Sphere,0);

Now it works, thank you all

Greetz

Link to comment
Share on other sites

what version are you using? this issue or one very similar was supposedly fixed for LE 2.32 according to this BugReport

 

Also, you may want to look at downloading the newton SDK and getting the latest newton.dll from it. A couple of bugs were fixed that caused fast moving objects to pass through terrain, and I am not sure if Josh has incorporated the newest newton.dll into the Leadwerks SDK.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

I can't move them anymore once they got stuck.

 

SetWorldSize() is what you are searching for. Your objects are just stuck in the boundaries of your physics world :P

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Link to comment
Share on other sites

I am using gamelib, which complicates things even more(e.g. slidingcollision).

Slidingcollison is a LEO feature, not gamelib. Gamelib doesn't change any engine commands, but only adds new unique commands.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...