Proper collisions!?! Help!
Blitz3D Forums/Blitz3D Programming/Proper collisions!?! Help!
| ||
Erg. That's all I can think. Erg. Wibble wibble wibble... Does anyone have any idea how to solve my problem? I want my players to bounce off walls (not just reversing the direction, but bouncing like a cue ball off the sides). My collisions are set up as follows: Const car_col=1 Const world_col=2 Collisions car_col,world_col,2,1 (Note: I am using the Stop response so that Blitz doesn't try to automatically move the cars up or down) Then I look for collisions and try to correct them: If EntityCollided(c\mesh,world_col) ; PLAYER VS LAND xnorm#=CollisionNX(c\mesh,1) ynorm#=CollisionNY(c\mesh,1) znorm#=CollisionNZ(c\mesh,1) c\vx#=c\vx#+xnorm# c\vz#=c\vz#+znorm# MoveEntity c\e,c\vx#,0,c\vz# ResetEntity c\mesh End If This appears to work at a slow speed, but if my car heads straight for a wall quite often it just cruises on through it bobbling slightly... can anyone help? I really want to try and get some nice collisions in my game but (to be honest) I am no mathematician!! Thanks in advance! |
| ||
might sound silly, try instead using True not 1. i had nuber of problems using 1 and true. Shouldnt really matter, but the results were different |
| ||
1 and true should mean the same thing or that's a bug! |
| ||
i know, 1 and true seem to mean different things for my programs, so i stick with true. it could be a bug |
| ||
If not(true=false) then true=true else true=1 end if Confused? I don't even think I'm using true in the collision script! Argh! Brain hurt. Must lie down. Thx anyways! |