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
    Posts
  • #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!

    #20905

    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

    #20911

    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?

    #20915
    Avatarjohngrigni
    Licensee

    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.

    #20922

    @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.

    #20923
    Avatarjohngrigni
    Licensee

    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.

    Attachments:
    You must be logged in to view attached files.
    #20955

    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?

    #20956
    Avatarjohngrigni
    Licensee

    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

    #20964

    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?

    #20978
    Avatarjohngrigni
    Licensee
    #21060

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

    #21066
    Yuri KovelenovYuri Kovelenov
    Developer

    @vergegraphy glad you found a solution!

    @johngrigni
    thanks for helping out!

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

    #34552
    AvatarMaha
    Newbie

    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.

    https://we.tl/t-bWosUIvXR0

    PS:the fps camera starts after clicking fps text

    • This reply was modified 1 month, 1 week ago by AvatarMaha.
    Attachments:
    You must be logged in to view attached files.
    #34554
    Avatarvisualizer
    Newbie

    @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.
    #34824
    AvatarMaha
    Newbie

    Hi @yuri can u help ?

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