Dumb Question
Blitz3D Forums/Blitz3D Beginners Area/Dumb Question
| ||
There may be no such thing as a dumb question, but this one surely is. How do you use the command EntityCollided? |
| ||
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) |
| ||
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. |
| ||
have you set your collisions? Like: Collisions 1,2,1,3 |
| ||
try using:If EntityCollided(bubble\entity,3) <> 0 Thats how I use the command and it works fine. |
| ||
I get it now. Thanks, guys. |
| ||
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? |
| ||
Don't forget to call UpdateWorld which is when collisions are actually detected. |
| ||
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 |
| ||
If my line didnt work than skid is right. You need to add UpdateWorld somewhere near the end of the mainloop, |
| ||
double post sorry again. dang, 2 double posts in one day. I havent had one in a long time |
| ||
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. |
| ||
"When the sphere crashes into stuff, it seems the pivot continues moving. Any advice?" Enable collision on the pivot rather than on the sphere.. |
| ||
Here's the entire code, as requested: |
| ||
|
| ||
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 |
| ||
boomboom, did he just setup types wrong? I cant tell without reading the whole code. |
| ||
Yea. And then was applying the collision to a sphere, but driving the pivot, so it would all go out of sync. |
| ||
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. |
| ||
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. |
| ||
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? |
| ||
let me see. I thought i fixed that |
| ||
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 |
| ||
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? |
| ||
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. |