Search code examples
unity-game-enginegoogle-street-view

Adding Google Street View Images to Unity Project


I'm completely new to Unity and I'm starting to work on a little game for my class. The scenario says that the main character should be placed in my home town.

Since I'm not capable of modeling my town, I tried making skybox from google street view images using free plugin I found. It looks ok, so I tried adding an avatar, and that's where I'm having troubles. When adding an avatar, he falls trough the floor, I suppose because its only image underneath him. Then I tried adding box below his feet, and now he levitates in squat position abowe it.

Has anyone any suggestions or ideas on how to fix this? Or maybe some suggestions on different vay of doing this would also be apprechiated.

Here is a photo of what it looks like now: https://postimg.org/image/ehklr8sg5/


Solution

  • The reason your character falls is because there is no "floor" yet. The skybox is nothing but a special cube that wraps infinitely around your scene. With the street view images it may appear like the character is standing on solid ground based on the optical illusion of the skybox, but they're actually floating in space. When you press play, the physics engine starts, gravity takes hold, and your character falls.

    There are a number of ways to prevent them from falling.

    Disable Gravity on Character

    This is only a good idea if you're not planning to use physics in your game.

    • Select your character's root node in the Hierarchy
    • In the inspector, find the RigidBody component
    • Uncheck Use Gravity

    Add Floors

    Add something with a collider on it that doesn't have a RigidBody. The collider will prevent the character from passing through it and the lack of RigidBody will ensure it doesn't also get affected by physics or gravity.

    • Create > Plane
    • Set its transform position to 0, 0, 0 so it's centered in the world
    • Scale it up big enough for your character to land on
    • Uncheck the Mesh Renderer in the inspector to make the plane invisible