FPS game+camera movemenat and zoom at once

This is my first post in BGE -I have just started so please for forbearance :wink:

I made a simple gun shooting that is in right hand. I want to make an effect where the camera moves to the gun and makes zoom -you know -when you put a gun with a scope to the cheek.

I made two actuators for camera:

first is to change the focal lenght of the camera -to make zoom (focal lenght in frame 1 is 22 and in frame 20 = 36)
second is to move camera to the gun
Whole action lenght is 20 frames.

I got one sensor which is mouse button. When I connect all I doesn’t work, but separatly it does.

What is going on ?

This feature/effect you describe is “iron sight” if you want to use it to search. Usually you make iron sights and scopes by animating the gun to move to the center of the screen instead of moving the camera, which is more problematic in the long run.

I got one sensor which is mouse button. When I connect all I doesn’t work, but separatly it does.

Can you be more specific about this?

Are you using logic bricks and how does your brick setup look? If I understood correctly you have animated the position and focal length with actions?

. Usually you make iron sights and scopes by animating the gun to move to the center of the screen instead of moving the camera, which is more problematic in the long run.

I actually disagree. Infact, it’s exactly the opposite. What if you zoom and shoot at the same time?

If using Logic Bricks: I would say animate the camera, with action being Flipper. Then use the rarely-known Texture-to-render in python to make the sight “Zoomed”

I actually disagree. Infact, it’s exactly the opposite.

It’s not a matter of opinion. It’s not the opposite either.

All games I have ever seen using iron sights (Day of Defeat source, Battlefield, Call of Duty…) implement iron sights just by animating the gun viewmodel to move to the center and apply camera FOV change plus depth of field effect. Camera stays still all the time. Camera represents the player position as well as the weapon line of fire origin point and camera orientation represents the line of firing rayCast vector. The gun orientation and muzzle point is irrelevant to the rayCast that is used to fire.

What if you zoom and shoot at the same time? in a cross-networked game you will end up with a messy glitch that is somewhat hard to fix.

What do you mean? Because of what I explained above it doesn’t matter what the gun view model does. This doesn’t result in a glitch.

Only the following variables are negotiated with the server: player location (equals to camera x,y, how they handle z varies), player orientation, crouch/jump/fire status. The negotiation happens through input (player tries to move and server gives clearance to it or denies it if the path is blocked) with the player client doing extrapolation until the server corrects it. Using the method of moving camera would result in just another float variable that needed to be synced with server for consistent playback.

So on contrary: if you move the camera location instead of gun viewmodel the following glitches (can) occur:

  • camera goes through a wall
  • player views the world different from where he physically stands
  • rayCast vector origin point and direction are unclear
  • player location and line of fire are inconsistent with player first person view and third person view

It doesn’t even make sense to move the camera from real world point of view. If you have ever fired a weapon while standing or especially moving you know that you can’t just take your head to the side to use the sights: you must bring the weapon in front of you so you can maintain your balance.

These problems were solved long ago and what I describe is true and well tested method.

never said it was a matter of opinion. Animating the camera will result in it looking more realistic and will allow the gun to perform other actions while you are zooming in. the camera represents your eyes, so when you use your sight, you move your head to see through it.

you must bring the weapon in front of you so you can maintain your balance

not really…I’ve never been in a realy battle, but I tried it with my little bro’s nerf gun, and I seem to be just fine moving my head instead of the gun.

I suppose you would move the gun if the gun was a pistol, or any kind that you need to lift…but if you have an AR then the gun is almost already your shoulders, so you would move the head instead of the gun

not really

Well I’ve done all kinds of things in army such as rushes with real AR, real ammo, real recoil, real weight and I can tell you the gun won’t be at your shoulder and you need to move the gun a lot and you will keep your head close to the line where your center of weight lies.

But aside from that, animating the gun viewmodel is just the only sensible way to make it. You are also welcome to look at any game examples. I’ve taken apart quite a lot of FPS games to be able to say this.

Yes, I’ using logic bricks -but I understand I can use some other ways (without scripting) to make the game works ?
You told lot of useful thing I did’ knew -I’m noob in gaming :expressionless: . Some functions I still don’t know and all Information is well seen.

Will do this gun -to- head animation with focal lenght change …

That’s all for now.

THANKS for help :wink:

Not first, and not last thread…