Collision problems

Blitz3D Forums/Blitz3D Beginners Area/Collision problems

grindalf(Posted 2016) [#1]
Ok I don't have much information to give really
I'm not going to paste all my code as it goes into over 4000 lines of code but I will paste the relevant parts.

at the start of my code I have
Collisions 2,1,2,3


then I make a player and give it a type
EntityType ppiv,2

then I make my area and give it a type
EntityType area,1

then I have a piece of code that is supposed to trigger when I touch the area(I changed it to end for testing. Program does not end)
If EntityCollided(ppiv,1)>0 Then end

the thing is. That is my only collisions command but the player does not fall through the level(I translate ppiv downwards to simulate gravity) so the collisions are working but it does not end the program.
This was working before. I rewrote it all into a new file as I had to modify a large portion of how the world was handled this piece of code is identicle but its not working now.

I don't expect someone to see an error but maybe someone has seen similar problems and can point me in the right direction as to what I'm doing wrong here


RustyKristi(Posted 2016) [#2]
Hi, have you checked with the samples provided. There's also online examples from the manual here..


grindalf(Posted 2016) [#3]
Just solved it. Somehow I managed to have 2 updateworlds in my code.
Not sure why that would stop it from working but it did


RustyKristi(Posted 2016) [#4]
I don't think 2 updateworld is necessary but good for you.


grindalf(Posted 2016) [#5]
Yeah it must have been when I was copying and pasting from one file to another. I somehow got 2 updateworlds in. I'm not sure why it would stop entitycollided from working though.


Kryzon(Posted 2016) [#6]
EntityCollided is returning the state of the collision as computed on the last UpdateWorld, so on one UpdateWorld it detected a collision (and the system corrected it, that is, repositioned the entities to remove the intersection so they are not colliding anymore), and then the second UpdateWorld doesn't detect any collision and rewrites the state that Collided returns.

Please note that the error was in a part of code that you were not going to post because it was over 4000 lines.


jfk EO-11110(Posted 2016) [#7]
I wouldn't want to read 4k code anyway.

And yes, EntityCollided is eaten up, just like MouseHit, Keyhit or so. A common mistake is to position UpdateWorld at the wrong place.


RemiD(Posted 2016) [#8]
[offtopic]
@jfk>>glad to see that you are still alive and well ( oooh great mentor ! ;) ). If you have some time, take a look a this code : http://www.blitzbasic.com/codearcs/codearcs.php?code=3282
It is a collisions system using linepicks and pickables, you may like it.
[/offtopic]


jfk EO-11110(Posted 2016) [#9]
Yeah I'm fine, thanks. You too I hope. Every now and then I use Blitz, to solve problems, display things or just for fun.

Saved your code, thanks!


RemiD(Posted 2016) [#10]
@jfk>>i'm ok thanks.
I am curious to know how you managed the collisions detection and repositioning for your CSP games, so when you have some time, i would appreciate if you could post a brief explanation of your method. (because as you know, there is no capsule collider with Blitz3d and a humanoid character has a capsule shape, not a sphere shape (and the stretched sphere shape on the y axis causes problem in some cases...)