Home › Forums › Programming › How to move camera using keyboard and mouse
- This topic has 15 replies, 6 voices, and was last updated 4 years ago by visualizer.
-
AuthorPosts
-
2019-10-30 at 5:29 pm #20867vergegraphyParticipant
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!
2019-10-31 at 10:48 am #20905Alexander KovelenovStaff2019-10-31 at 11:59 am #20911vergegraphyParticipantThank 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?
2019-10-31 at 1:06 pm #20915johngrigniCustomerYou can make ‘breaks’ in the floor object near the walls. You could make the floor object separate from the visible floor for this purpose.
2019-10-31 at 5:32 pm #20922vergegraphyParticipant@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.
2019-10-31 at 5:51 pm #20923johngrigniCustomerBasically 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.
2019-11-02 at 1:49 am #20955vergegraphyParticipantI 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?
2019-11-02 at 2:23 am #20956johngrigniCustomerThe actual floor object doesn’t have to be visible. It can be just below the visual floor object, which wouldn’t have any holes
2019-11-04 at 10:31 pm #20964vergegraphyParticipantThank 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?
2019-11-05 at 1:25 pm #20978johngrigniCustomerI set up a simple scene here:
http://www.argosdesigns.com/FloorTest/FloorTest.htmlThe folder for it is here:
https://www.dropbox.com/sh/uzgvo1cc6j778ti/AAD0UyOo1iNnpnPAfJL-SPcZa?dl=02019-11-12 at 9:33 pm #21060vergegraphyParticipantThis actually seems to do the trick! Just wanted to confirm. Thank you so much !!
2019-11-13 at 10:46 am #21066Yuri KovelenovStaff@vergegraphy glad you found a solution!
@johngrigni thanks for helping out!2020-10-24 at 1:07 pm #34552MahaParticipantHi , 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
Attachments:
You must be logged in to view attached files.2020-10-24 at 2:57 pm #34554visualizerCustomer@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?2020-10-31 at 5:09 pm #34824 -
AuthorPosts
- You must be logged in to reply to this topic.