Announcement

Collapse
No announcement yet.

RTS camera: sphere trace doesn't hit

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    RTS camera: sphere trace doesn't hit

    Hello everyone,

    so I want to make a game thats basically an RTS game. Business simulation and building. If you know the anno games, you get an idea of what I mean
    I'm very new in game engines. I made my first footsteps in Unity and now decided to switch to unreal engine with my game.

    I just started to build up the fundament and create the camera system. I really like the camera controls in the Anno games and I also got through a lot of tutorials regarding this and basically the camera already works fine.
    I used this tutorial to create the camera: I just removed the pitching of the camera from the rotation controls and added it with the zooming so the camera does some slight pitching while zooming.

    However... my problem: Actually I try to make the camera go up when it hits the terrain so it won't clip. In unity I just used a sphere ray around the camera object and so I tried here.

    Click image for larger version

Name:	blueprint.jpg
Views:	1
Size:	482.7 KB
ID:	1170378

    My understanding of that sphere trace is that
    - the Start node is the 'core' of the sphere (location of my camera)
    - the End node is the distance from my camera, the rays should cover / their length (in my case the 200 units x, y and z away from my camera location)
    - the Radius node is the area in degrees on the "ball" / sphere that emits the rays (360 for ever direction in my project)

    So when the sphere hits my landscape, its Return Value node says "yep, hitted!" and the camera height will by adjusted by +50.

    If my understanding is right, this should be working easily but somehow it doesn't. The sphere just won't detect my demo-landscape except of one point/hill on the whole island:

    Click image for larger version

Name:	in_editor.jpg
Views:	1
Size:	572.8 KB
ID:	1170379

    What could cause this behaviour? Did I understand something wrong? When I hit the hill in the orange circle, the camera rises as expected.. but why not at the other hills?
    Can anybody give me a tip?

    Thank you very much!!
Working...
X