We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

How to move camera using keyboard and mouse

Home Forums Programming How to move camera using keyboard and mouse

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
  • #20867

    Hello, everyone. Before going into topic I just want to say I am delighted after 10 years of dreaming to discover a tool like this which allows my photography website to become 3D… I am learning Blender now and I have imported some objects and created my own gallery with photographies as paintings on the wall.

    What I want is to be able to override the default W,A,S,D keys in order to have the user smoothly advance through the floor while at the same being unable to pass through objects. For example, I do not want them to be able to climb up the stairs at this momeent or through the sustaining walls or even the floor itself… How could I possibly do that?

    I searched through the forum and found ways to retrieve the camera and to set its position upon pressing a key. I even wrote a piece of code for the key ‘W’ and while the console shows it has been pressed the camera still jumps… and tweening animation is not smooth for me, it is too jumpy. Any resources would help besides the manual (and I suppose the book is not yet written).

    Thank you very much!


    Hi, thanks you for your kind words.
    To move you camera in character mode, assign the First-person controls for your camera and then use some mesh below it to be a floor. See the city example in our Verge3D distribution (located in applications/city folder).

    Co-founder and CTO at Soft8Soft
    FB | Twitter | VK


    Thank you for your reply! Yes, I have successfully done that. The only issue remains that it will still go through paintings, walls and other materials. I am trying to assign the “Collision material” to more than one object but it did not work somehow, how can I bypass the restriction of having just one collision material?


    You can make ‘breaks’ in the floor object near the walls. You could make the floor object separate from the visible floor for this purpose.


    @johngrigni : Interesting suggestion. Could you please elaborate a little? From my understanding, I have created a spatial gap between the wall and the floor and added a floor behind the wall, but it would be inefficient to duplicate the floor just to act as a solid object behind the others. I apologize for the misuse of Blender or English if that is the case. I might even share the .blend file or something.


    Basically any gap in the floor object is impassable. So if you make cuts in the mesh of the floor object, they can’t walk past the interruption, but they can walk through a door. Or they can walk up a ramp as stairs.

    You must be logged in to view attached files.

    I finally get it. I will update this if I was able to do it or not. Very interesting, I would have never expected something like this. According to your drawing, everything should be separated if I want the user to be unable to reach. But the limitation is the empty space itself. The user will see the gray background and lots of gaps I must be forced to fill somehow in order for it not to look ugly… are we sure this is the only way?


    The actual floor object doesn’t have to be visible. It can be just below the visual floor object, which wouldn’t have any holes


    Thank you. I have tried it. I found some interesting stuff. The scene I bought has an interior gallery. Camera does not go through the floor, it is perfect. It goes through walls, but stops after about 1 meter or so… Both the walls and the floor have the same “Floor” material applied with the same variables. I made sure the clip is set to a low value (0.1), I modified the gaze accordingly, made sure the object is also rough and pretty much tried many things I found about Blender on forums, but I got bad luck.

    When I add the “Floor” material to other objects for some reason it still goes through though… any other ideas?


    This actually seems to do the trick! Just wanted to confirm. Thank you so much :good: !!

    Yuri KovelenovYuri Kovelenov

    @vergegraphy glad you found a solution!

    thanks for helping out!

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博


    Hi , can u please explain to me how to do this in 3dsmax & with puzzles? do i have to add another invisible walls to prevent the character from flying out ? i guess there is something wrong here , i cant pass the yellow line in the attached pic .

    I attached the game i’m trying to do (we transfer) ,,,

    I also need help in :

    1-making the monster vanish after being shot.
    2-make a game counter and timer.


    PS:the fps camera starts after clicking fps text

    • This reply was modified 1 month, 1 week ago by AvatarMaha.
    You must be logged in to view attached files.

    @johngrigni Hi

    I was just checking the floor test.
    Its really cool to see that camera doesn’t go through. Also I see it sticks to floor and doesn’t fly unnecessarily.
    Do we need to make any settings in blender before publishing?

    • This reply was modified 1 month, 1 week ago by Avatarvisualizer.

    Hi @yuri can u help ?

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.