Jump to content

Collision without Physics?


AnniXa
 Share

Recommended Posts

is it possible to have collisions and stuff without need to use of phyisics?

I want to move the entitys just with moveEntity() and stuff and check if they touched something.

 

i know i can start now writing the raycasting stuff, but there is still all that stuff and i dont want to waste alot of time for making raycast tests, is it not possible to use it without body force stuff?

 

i dont want them to fly around or falling down after a collision when i use apply force stuff,

i just want them to have collisions, maybe slide but at all i just want the callback.

Whuts wroong?

Link to comment
Share on other sites

hm bounding boxes would not work since i got some kind complex terrain

for now i use SetBodyVelocity and try it with that, but there is so much stuff that is annoying, i dont need/want all thet physic stuff and now i need to waste cpu/gpu time into this, and then i just force the values to some fixed ones ><

 

seems i rly need to start over with that raycast stuff :)

Whuts wroong?

Link to comment
Share on other sites

I think bounding boxes would still work wouldn't it? With the EachEntityInAABBDo() function you can ignore things you don't care about like the terrain and instead look for other things that are colliding and react.

 

Or are you wanting to do your own gravity with this this? For gravity without physics on terrains only you could get the players x & z position, then get the terrains height (there are functions for this) of the same position, then position your players y value to that.

Link to comment
Share on other sites

i want to check my entity VS those map terrain (somewhat minecraft like map)

i use createBodyTree for the clipping parts of the blocks

i dont think i can use simple aabb tests there, but maybe i should have ben said earlier

 

but for now i improved something with that body stuff, i use moveEntity, and before every move i use setBodyVelocity with 0,0,0, and i force the angle of the mover body to stay like it is.

 

maybe i will later have alot fun with that physics thingie so i think i just let it so for now.

 

2870985mesh.png

 

Why not use physics but just set mass to 0.0 on objects.

 

i tried that, but then i got no collision, the body is allways red with the phyisc debug mode

  • Upvote 1

Whuts wroong?

Link to comment
Share on other sites

Yeah, the controller is meant for moving things easily with physics easily and not worrying about it falling over because of incorrect force applying. It's basically meant to easily move your characters around with physics.

Link to comment
Share on other sites

i slaughtered a sample now for a quick & dirty test =)

for now it seems to be fine, no bouncing and strange rotating or something.

 

but it acts more like a spaceship in space then a person on ground.

 

i mean it takes a while until it comes to speed, and then when i release the key it have a long way to brake.

 

what am i doing wrong?

 

i did this before the loop:

 

Global testController:TController = CreateController()
CreateCube(testController)
SetBodyMass(testController, 1)
PositionEntity(testController, Vec3(15, 4, 15)) 'set it into the map
EntityType(testController, 1)
Collisions(1, 2, 1)'world is 2, entitys got 1
Global move:Int = 0.0
Global strafe:Int = 0.0

 

and thats the loop:

Repeat
If KeyHit(KEY_ESCAPE) Exit
If AppTerminate() Exit
move = (KeyDown(KEY_W) - KeyDown(KEY_S)) * 5
strafe = (KeyDown(KEY_D) - KeyDown(KEY_A)) * 5
UpdateController(testController, 0.0, move, strafe)

UpdateAppTime()
UpdateWorld(AppSpeed())
SetBuffer(gbuffer)
RenderWorld()
SetBuffer(BackBuffer())
RenderLights(gbuffer)  

tann2d.start2d()
anngui.draw()
tmouse.draw()
tann2d.end2d()
Flip(0)
Forever

Whuts wroong?

Link to comment
Share on other sites

Look at the function definition to UpdateController. There are more than what you have so that means you are using defaults. There is an acceleration parameter. The higher you set that the faster starting and stopping is. Play around with that value and you'll get better response.

Link to comment
Share on other sites

cool thank you, that acceleration parameter in the updateController function was the problem =)

no i have a nice moving "player" with colision to the map.

 

thank you all for your time.

Whuts wroong?

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...