Product Chat / Camera clipping on large objects

Author
Message
Dream Scape
16
Years of Service
User Offline
Joined: 21st Sep 2008
Location:
Posted: 10th Mar 2019 11:54
Hi there

Because of the type of game I'm building the built in terrain doesn't quite work. So I've decided to build it as a 3d model instead.

However, I've noticed that in 3rd person the camera clipping/movement when you go near an object doesn't seem to work well (the camera goes through the terrain so you can see the default terrain outside).

It seems to work when the camera hits the bounding box of the model, but not the polygons. This seems to be fine for smaller objects (ie the camera moves closer to the character until it becomes 1st person) but not for something as large as a level. I've tried changing the collision to polygon but that has no effect.

Any help on how / if this can be fixed would be much appreciated.

Phil
PM
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 10th Mar 2019 12:03
Hi Dream Scape
This is a bug already reported and an annoying one ..
The clipping issue for me seems to be more on the right hand side and all you can really do is add to the bug list on Github and hope it gets looked into but there is a huge list so far for Lee to go through
https://github.com/TheGameCreators/GameGuruRepo



The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
Dream Scape
16
Years of Service
User Offline
Joined: 21st Sep 2008
Location:
Posted: 11th Mar 2019 20:38
Hmm... this doesn't seem to be quite the same as the bug shown in the video.

The camera doesn't even attempt to be blocked by the object, it just goes straight through. It's only when the camera gets to the bounding box does it start to apply the movement to the camera position.

I'll do a few more tests and see if I can confirm.
PM
Dream Scape
16
Years of Service
User Offline
Joined: 21st Sep 2008
Location:
Posted: 11th Mar 2019 23:40 Edited at: 12th Mar 2019 00:02
I've tried with multiple objects of differing sizes and positions and I've narrowed it down to the IntersectAll function which is called in GamePlayerControl at:

tthitvalue=IntersectAll(ttpx,ttpy,ttpz,tffdcx,tffdcy,tffdcz,ttpersonobj)

It seems that for large objects there's an upper limit as to how far from the centre point of the model it can calculate a raycasting hit, and this limit is about 200 ingame units.

This means that when you're more than c200 units from the centre of the model, the IntersectAll stops working an returns a value of 0 (and the camera clipping/movement reverts to the standard camera distance).

However I've solved your problem with the following code as a replacement in the GamePlayerControl:



Basically what this does it project the camera 2 units further out from the player before checking the intersection with entities. Then when it comes to positioning it, it moves the camera 2 units closer (but slowly reduces this value the closer the camera gets to the player so the transition as the camera swings by is un-noticable).
PM
Dream Scape
16
Years of Service
User Offline
Joined: 21st Sep 2008
Location:
Posted: 12th Mar 2019 06:52
I've updated the github issue to reference my solution.

I will keep working on my problem with large objects and if it appears to be the IntersectAll function report it as a bug
PM
granada
Forum Support
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 12th Mar 2019 10:45
Sounds like you have it sorted ,nice job

Dave
Windows 10 Pro 64 bit
GeForce GTX 1050 Ti
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
1920x1080,60 Hz
PM

Login to post a reply

Server time is: 2024-11-24 01:42:10
Your offset time is: 2024-11-24 01:42:10