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.

Dark GDK / Smooth camera collision

Author
Message
Malboro Jones
14
Years of Service
User Offline
Joined: 10th Dec 2009
Location: Wales - UK
Posted: 17th Nov 2010 17:28
I've done it before but can't remember how, I'd like the camera to follow the player but collide and adjust if it hits the terrain etc.

How would I go about this? I've tried placing a "feeler" object to detect the collision and move the camera closer to the player but it's not very nice.

Thanks, Mal.

Don't make war, make tea.
_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 17th Nov 2010 18:08
I would say do a ray cast (or a sphere cast, which adds a "width" to the ray) from the player position to the final camera distance.
Then position the camera at the collision position.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Malboro Jones
14
Years of Service
User Offline
Joined: 10th Dec 2009
Location: Wales - UK
Posted: 17th Nov 2010 19:32
Ye good idea, I'll give it a try, thanks

Don't make war, make tea.
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 17th Nov 2010 21:58
I put a sphere around the camera with a high radius so it doesn't adjust to small nooks and crannies only large angles. Then I have it ray cast from the character and position it where the collision happened. For buildings to make it a little more smooth, I create a box around the building and use that for collision so that it doesnt collide with detail objects. I just hide the box.
Malboro Jones
14
Years of Service
User Offline
Joined: 10th Dec 2009
Location: Wales - UK
Posted: 18th Nov 2010 18:23
I did something similar, positioned a sphere at the character position and point it at the camera then use this to move it towards the camera:



This works fine! but it seems to cut the fps in half why is it causing so much damage to the fps?

Don't make war, make tea.
_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 18th Nov 2010 19:19
Because

a) you're doing 11 object collision checks per frame with your for loop

b) you're not using Sparky's Collision, which is a lot faster

And if you're doing it like that you could do a sphere cast with Sparky's which will be a lot faster (avoiding the for-loop) and will have the same effect.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Malboro Jones
14
Years of Service
User Offline
Joined: 10th Dec 2009
Location: Wales - UK
Posted: 18th Nov 2010 19:22 Edited at: 18th Nov 2010 19:27
Aright! I've used that with db before, where can I get it for GDK?

Thanks.

Edit:

Never mind found it

Here for anyone who's interested:
http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5

Don't make war, make tea.
Malboro Jones
14
Years of Service
User Offline
Joined: 10th Dec 2009
Location: Wales - UK
Posted: 18th Nov 2010 20:13
Yep awesome, got it working perfectly!

Thanks for the help

Don't make war, make tea.
_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 19th Nov 2010 14:02
No problem, I'm glad I could help.
The big Thanks has to go to Sparky for making this awesome plugin

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 20th Nov 2010 08:32
Yeah, Sparky's is amazing

Login to post a reply

Server time is: 2024-06-30 10:46:20
Your offset time is: 2024-06-30 10:46:20