Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / object a and b collision not working correctly when you turn one object

Author
Message
bg38
15
Years of Service
User Offline
Joined: 28th Oct 2009
Location:
Posted: 13th Dec 2009 09:15
I've been working on this fps project using some personal models, and some freebies, like the shed and such from kravenwolf. my thanks for him being willing to share them

Basically, you play as a chicken, set on overthrowing the farmer and his allies in a bid to take over the farm for yourself.

I made an animated chicken wing to throw the egg grenades, and have it and the camera working like needed.

After putting up the fence sections i modeled, instead of trying to turn collision on for all of them, I made two long boxes, and positioned each one in the same spots as the two lengths of fences on either side of the road, turned the collision on those and hid them.

So far so good. I set collision on the chicken wing, and it works fine when you approach something head on, or at an angle.

Whenever you are against the fence, or one of the sheds, for example, and go to turn around without moving away from the fence,your character will go through the collision box and end up on the other side, but the collisions still work from the backside as well until you turn again and are pushed to the opposite side of said obstacle.

I posted the portion of the code where I made the hidden boxes and the collision code, along with a couple screen caps from the scene so far.

I set object collision on boxes, polygons, and spheres with the same effect.

I also tried the sliding collisions coding but am still working that one out ;0

hidden box and collision with character code. first version so it more than likely needs tidying up somewhat. I believe the collision coding came from a TDK tutorial,if I'm not mistaken. if so my apologies to whoever did make that particular tutorial


thanks in advance for any help.


and in case you're wondering, that white blob is the wing, only with no textures yet







Attachments

Login to view attachments
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Dec 2009 16:51
Without media, no-one can run your snippet, so it's only guesswork, but looking at your code, you could make things easier for yourself by using Set Camera To Follow instead of calculating the camera position.

Also, object collision(100,51) is checking for a collision between two specific objects - the hidden wall and the wing (51)?

As the wall isn't moving, you are wasting far too much time checking for collision with something that's hardly ever going to be collided with.

You should be checking for collision between the moving object (the wing) and ANY object using Object Collision(51,0). This is covered in my basic collision tutorial if you don't know about the ,0 parameter.

TDK

bg38
15
Years of Service
User Offline
Joined: 28th Oct 2009
Location:
Posted: 13th Dec 2009 16:58 Edited at: 13th Dec 2009 18:14
thanks a lot for your reply
I'll try setting it as you suggested, with the '0' parameter.
and yes, '51' is the animated wing object.
i'm getting the hang of this,slowly but surely, and my thanks for you and the others who took the time to make those tutorials for the rest of us


EDIT: I used the zero parameter as you suggested, TDK. That fixed the 'going thru' objects when turning around
I have a new glitch I'm working out tho but I want to try to fix it myself first. when starting the game your character is continually sliding backwards.
I'm thinking I need to work on the collision boxes you mentioned in the tutorial.

new edit : found part of my problem. looked at the very top of my code and saw I had forgotten to remove 'set global collision on' from my experimenting last night.

Login to post a reply

Server time is: 2024-11-24 23:17:44
Your offset time is: 2024-11-24 23:17:44