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 / A small FPS test, A player walks around in a small terrain, need help with collision

Author
Message
mnemonic
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden
Posted: 6th Feb 2012 13:00
I have made a small terrain using TE.d. It's small rocky landscape.
I'll show you nthe code, so that you can see what I try to accomplish



Object 1 is the terrain, and object 2 is the player object set to follow the camera as you can see in the first line in the application loop.

I have set the both objects to polygon collison, but they do not detect collisions at all (I can 'walk' through the terrain)

When I tried using automatic camera collision it worked, the camera collided nicely to the terrain. But now as you see I want the object themselves to collide, but they don't detect it? Anything else I have to do to make this work?

<a href="http://www.memblockgames.com">www.memblockgames.com</a>
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 6th Feb 2012 21:11
I'm going to assume the code you posted is not your actual code because I don't see any object collision statements (IF OBJECT COLLISION(cheese, mouse) = 1...etc). I think posting a little more of your code might get you some more in-depth answers.
Anyhow, off the bat I can suggest you don't use the camera to orient your player but rather use the player to orient the camera. The reason for this is because the camera (USING ARROWKEYS) is not subject to any physics. So a number of things can happen depending of how you've coded such as the player being repositioned before a collision check is done, the camera continuing to move even if the player has stopped or the player getting "dragged along" by the camera in spite of collision - to list a few (all depends on the code and structure). So rather put the horse before the cart.


This is a very crude example, and I'd generally not put all the code in one loop but in functions - anyway it's just an outline. Hopefully this solves the problem. If not you might want to post a more in-depth chunk of your code.

Login to post a reply

Server time is: 2024-11-23 22:45:39
Your offset time is: 2024-11-23 22:45:39