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.

DarkBASIC Professional Discussion / Collisions/Following Camera

Author
Message
eatsNoobs
14
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 30th Apr 2012 17:20
i cant get the camera to follow the player and i cant get collisions to work
cyril
18
Years of Service
User Offline
Joined: 6th Aug 2007
Location: 7 miles away from big ben
Posted: 1st May 2012 01:16 Edited at: 1st May 2012 01:19
Your post is pretty vague and sound very Defeatist.

For collision I'd admit to get sliding collision inside DBpro using native commands is a tricky task. Luckily the Sparky Collision Dll makes it easier to obtain sliding collision, doing the maths for you.
You can downloaded it from here:

http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5

Remember to use "SC_updateObject" after you move an object, I always seem to miss this out all time, before I made a function to move dynamic object requiring collision.

Read through the command help files carefully and look at the Sliding collision example's source code. You should be able to device a common function for it.

For the Camera problem, while its not the best solution, have you at least tried the the command "Set camera to follow [X,Y,Z,Angle,Distance,Height,Smoothness,Collison]"

Where:
X is the X position of the point you want to track (normally you would pass your Character's X position).

Y is the Y position of the point you want to track (normally you would pass your Character's Y position).

Z is the Z position of the point you want to track (normally you would pass your Character's Z position).

Angle is the Angle of the Camera, with an Angle of 0 meaning you are looking up the Z axis (normally you would pass the total of the Old Angle and the Left/Right (X movement of the mouse)).

Distance is how far the camera is to the point (This would normally be static).

Height is how high the camera would be positioned (again this is normally static).

Smoothness is how quick it will change position (best kept at 1, however for some style of games like RTS's you might want to pass a Distance*constant with a value range check for a fixed camera movement speed).

Collision will stop the camera from moving through objects when set to 1 (This is somewhat reduntant when using sparky's collision, and is best set to 0, unless you decide to use built in collision for the camera (sparky Collision is normally faster)).

After that you could "Point Camera [X,Y,Z]" Commmand
Where:
X,Y and Z is the same values as in the previous command. That way your camera is looking directly at your character.

-

I have another Option is better for action style games where there is loads of static objects near to where the camera is, since the camera can get stuck on walls with the command above. but you could start with the above first, since it's a great starting point.

And don't give up, privately or publicly, things look hard in the begin, but it gets easier as you get used to the behaviour and dependence of different commands; which will lead you to a common structure for your desired project, even though I'd recommend write up a basic design plan first before doing anything big.

Edit: Fixed link
eatsNoobs
14
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 22nd May 2012 17:58
thanks i got the camera to work on my own though and collisions i just gave up and made up an alternative lol thanks though

Login to post a reply

Server time is: 2026-07-22 02:24:27
Your offset time is: 2026-07-22 02:24:27