Dumb Question

Blitz3D Forums/Blitz3D Beginners Area/Dumb Question

Buggy(Posted 2006) [#1]
There may be no such thing as a dumb question, but this one surely is. How do you use the command EntityCollided?


boomboom(Posted 2006) [#2]
Well say you want the handle of the tree your player is collided with.

Players are collision type 1
Trees are collision type 2
Ground is collision type 3

(these above are just example collision type numbers, you set them with the EntityType command)

You can't just check for generic collisions, becuase your player will probably be collided with the tree and the ground. So you are just looking for what tree hes collided with, which is type 2.

CollidedTreeName = EntityCollided(Player,2)


Buggy(Posted 2006) [#3]
This is my code:

For building.building = Each building
		
			If EntityCollided(bubble\entity, 3)
			
				FreeEntity building\entity
				Delete building
				
				DebugLog "Sup?"
				
			EndIf
		
		Next


But nothing happens. It doesn't even say "sup?" in the debug log.


boomboom(Posted 2006) [#4]
have you set your collisions? Like:

Collisions 1,2,1,3


n8r2k(Posted 2006) [#5]
try using:
If EntityCollided(bubble\entity,3) <> 0

Thats how I use the command and it works fine.


Buggy(Posted 2006) [#6]
I get it now. Thanks, guys.


Buggy(Posted 2006) [#7]
Hmm. I changed it to n8r2k's suggestion, but it still doesn't work!

Also, my game involves a sphere rolling around. The sphere is pivoted around a point so it can roll, but not go into the ground. When the sphere crashes into stuff, it seems the pivot continues moving. Any advice?


skidracer(Posted 2006) [#8]
Don't forget to call UpdateWorld which is when collisions are actually detected.


mindstorms(Posted 2006) [#9]
You will have to put a trigger for the pivot in the collision check so that it, too will stop moving when the sphere stops moving


n8r2k(Posted 2006) [#10]
If my line didnt work than skid is right. You need to add UpdateWorld somewhere near the end of the mainloop,


n8r2k(Posted 2006) [#11]
double post sorry again.

dang, 2 double posts in one day. I havent had one in a long time


boomboom(Posted 2006) [#12]
If you can't get it to work, prob best to post up your entire code. Collisions have quite a few things that need to be placed to get them working.


Jams(Posted 2006) [#13]
"When the sphere crashes into stuff, it seems the pivot continues moving. Any advice?"

Enable collision on the pivot rather than on the sphere..


Buggy(Posted 2006) [#14]
Here's the entire code, as requested:




boomboom(Posted 2006) [#15]



Nicstt(Posted 2006) [#16]
Just thought I'd comment on 'dumb question'

My take on it is simple:

The only dumb question is the one that is never asked. :D


n8r2k(Posted 2006) [#17]
boomboom, did he just setup types wrong? I cant tell without reading the whole code.


boomboom(Posted 2006) [#18]
Yea. And then was applying the collision to a sphere, but driving the pivot, so it would all go out of sync.


Buggy(Posted 2006) [#19]
boomboom: Thanks a bunch!

Can you please tell me:

The changes you made to the code
Why the bubbles don't delete the buildings

Everyone, thanks so much for your input.


n8r2k(Posted 2006) [#20]
the exaust bubbles delete buildings now. I dont know why youd want them to, unless your making a statment about pollution. i put a line of dashes after the changes i made.



I dont have time to look through and see what boomboom did but maybe he could add comments to what he did.


Buggy(Posted 2006) [#21]
Thanks, n8. I didn't realize there was a difference between the buildings running into the bubbles and vice versa. There's no reason why, I'm just testing different things.

Why is it that all of the buildings delete at once though?


n8r2k(Posted 2006) [#22]
let me see. I thought i fixed that


n8r2k(Posted 2006) [#23]
Well I added color so i could see what i was doing, the collide and then delete process is a little choppy, your going to have to work on that, unless i come up with something in my sleep, but they delete when the bubbles run into them.

i replaced:
If EntityCollided((bubble\entity,3) <> 0

with this:
 If EntityCollided(bubble\entity, 3) = building\entity


when i realized that it was deleting buildings when the player runs into anything.

can you be more specific on what is happening


Buggy(Posted 2006) [#24]
Yes, yours works. What is happening? I'm just experimenting with deleting entities and such.

Also, why is it that if I add the command
EntityType sphere\exhaustpipe, spherecollision

in the beginning, after a building is deleted, the sphere goes all crazy?

Any more wonderful help?


n8r2k(Posted 2006) [#25]
I am not sure right now but it might be that you are setting the exaust pipe to collide with the sphere car thing.

If i have time later I can see what you mean.