Help with Collision?

Blitz3D Forums/Blitz3D Beginners Area/Help with Collision?

Guy Fawkes(Posted 2012) [#1]
I've taken it to the next level. I changed the enemies to Dwarves. I added player to object collision, player to land collision, and object to object collision. I fixed a rotation glitch when the enemy returns to its waypoint, due to collision.



PROBLEM is, the enemies wont pursue the player anymore....



Here's the project:



http://www.mediafire.com/?do051b8fw2h5tyj



Thanks for any help! :)







Thanks to anyone who helps with this! :)


Ginger Tea(Posted 2012) [#2]
Isn't this just a C+P from one of your posts in the Drak waypoint thread?

Cos I'm sure you or he fixed the pursuit problem and the fact that you were asking about collision towards the end and that THIS thread is called "Help with Collision?"

PROBLEM is, the enemies wont pursue the player anymore....


Shouldn't this be talking about any problems with collision.

Last edited 2012


Guy Fawkes(Posted 2012) [#3]
U misread it... Problem is the enemies won't pursue the player anymore, DUE TO collision -.-


Drak(Posted 2012) [#4]
What are you talking about Rez? I downloaded the whole thing this time and the pursuit works absolutely fine! I didn't even change anything...


Guy Fawkes(Posted 2012) [#5]
Try to make 2 or more enemies collide with the player at the same time. they point in the wrong direction and end up under the ground if theyre close to the player and have collided with the player...


I just need them to ALWAYS stay on the land. even during collision. and point the correct way

Last edited 2012


Drak(Posted 2012) [#6]
The problem lies in your gravity command. Some simple debugging commands tell me that the variable dist# gets WAY out of whack soon after the player purposely collided with an enemy. Get rid or change your gravity code in the main loop.


Guy Fawkes(Posted 2012) [#7]
Ok, that clears THAT up, but for SOME reason, when the enemy gets close to the player, he randomly starts pointing towards the ground, and moves towards the ground, then just stops.... o.o

Here's the code:







Thanks, Drak

Last edited 2012


Drak(Posted 2012) [#8]
Ok.

First of all you are creating your dwarves so that their EntityRadius is BELOW the ground plane, meaning they will fall below the plane when collided with and get screwed up.

Second, you don't have any collision between the enemies and the ground, either.

Third, you need to create enemies and the player ABOVE the ground plane and let gravity set them down onto it.

Fourth, (edited)

Fifth, you aren't applying gravity to the enemies.

Sixth, the player was before getting pushed down below the ground plane as well because the player was also created with it's EntityRadius below the ground plane.

Seventh, your gravity code you were using did not have desired effect of actually producing gravity.

Eighth, I fixed this in about 15 minutes with very little effort. Try some problem solving debugging commands first when you have problems.

Now until the next problem heres the code:



Guy Fawkes(Posted 2012) [#9]
That works almost. Thanks, Drak. The only problem I seem to notice now, is if u have 2 enemies following u at the same time, and the player is too close to both their waypoints, when they go back to their waypoints, they rotate weird.


Drak(Posted 2012) [#10]
C'mon man put some effort into it! At least TRY to figure out why that's happening. Do some problem solving!

We know that:
1. The models will sometimes rotate onto their backs when homing in on the waypoint.

2. We are using the PointEntity() command to home them in on that waypoint.

3. This can only mean that the return waypoint is slightly above the model.

4. If you wait a few seconds before moving, it won't happen.

This can mean only that since gravity is pulling the meshes down -.1 an iteration, that the models have not settled down onto the ground plane yet.

Solution: Wait longer before moving.


Guy Fawkes(Posted 2012) [#11]
Fixed it! Thanks, Drak! :) Turns out that the enemies were positioned at 2Y, rather than 1Y...


PositionEntity e\mesh, Rand(-20,20),1,Rand(-20,20) ;place the enemies randomly


Drak(Posted 2012) [#12]
Yes I know because I typed in the 2. Simply running the program and letting it run for 5 seconds while the enemies come down to the ground plane also fixes it.