ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Announcements and Showcase
forum topic indicator FPS camera crouch / stand action
person icon
sven
Registered User
Quote
2022-06-03 16:35:43

Asked so many times so i decided to make it.

Its nothing more but 2 cameras that you switch between -also camera targets will be synced so it looks like one camera in action.Also you cant stand up if there is no room.

To use it just create 2 cameras and add all behaviours to them that you need ( sometimes you cant use some weapons while crouch so dont add those weapons to crouch camera and so on..-disable jump on crouch cam and set movespeed different)

Video actually shows nothing informative so study from ccb file that i included.

Download link in video description:
https://www.youtube.com/watch?v=...

person icon
chipchuh
Registered User
Quote
2022-06-03 18:21:15

in simple a see sorc action but when i want add sorc he not added! cant add action why?

person icon
sven
Registered User
Quote
2022-06-03 18:53:17

its as usual action it can be added as action.
Maybe you tried to add it as behavior.

action can be added : if key C pressed then action SorC.

person icon
Guest
Guest
Quote
2022-06-03 19:50:46

This is how I made a crouch cam when I attempted to do it a month or so ago. I linked two cameras as well. The issue I ran into was the camera would get stuck moving forward without a key being pressed. Sven's example has the same issue. I believe I tried "resetting the behaviors of the node" to some success, but I never got it perfect. Any thoughts on stopping that bug, Sven? I believe one would have to script their own FPS camera to do so, but I might be mistaken.

person icon
sven
Registered User
Quote
2022-06-03 20:01:12

Guest

Issue happens because active camera cant unregister key event because of camera switch.
even if you restart behaviour and key is down then active camera cant register key down event..so issue again.

You can disable C key if movement key is active..
That means player can crouch if player have stopped moving.

or code movement script for camera .. and set FPS camera movementspeed to 0 and use your own code instead.

person icon
Guest
Guest
Quote
2022-06-03 20:33:17

@Sven

Yeah that's what I figured. It needs some workarounds. On a side note: I had a similar issue of the camera moving forward on its own if I switched the scene with an "on proximity" behavior. If I transitioned back to the other scene, then the camera would bolt forward on its own and not stop. I thought it might have had something to do with the collision, but then I read about the input cache in the forums. Anyway, I can still use your example crouch behavior for seeing how you stopped the camera from switching when under stuff. I don't think I got that far previously. Thanks, Sven.

person icon
andgameplay
Registered User
Quote
2022-06-05 03:53:29

Very useful action sven, thanks for share with us!

person icon
sven
Registered User
Quote
2022-06-18 16:13:23

Updated:
https://www.youtube.com/watch?v=...

Watch video to understand how it works.
Download link in video description.

Now there is custom camera movement script so there is no issue with camera moving byitself if camera switch done while keydown.

Now you can setup 3 speeds:
walk / run and crouch movement speed.

If there is problems with it then let me know and ill fix it.

person icon
guest_writer
Guest
Quote
2024-12-20 09:18:51

SVEN do redowload

person icon
sven
Registered User
Quote
2024-12-20 10:34:10

guest_writer wrote:
SVEN do redowload


Its on my itch page:(also many other stuff that may be useful)


https://itch.io/

person icon
guest_writer
Guest
Quote
2024-12-20 18:23:20

You are a very advanced programmer.

person icon
guest_writer
Guest
Quote
2024-12-20 18:30:15

sven can you help with recognizing the camera rotation I would like for example to make the camera rotate after death to make it fully rotate this matrix, but even it seems it should be clear that the reverb engineered the work.
I would like to simply execute the js code after death and the camera rotated







Define a helper class for matrix transformations
function Matrixhelper(bMakeIdentity) {
// If bMakeIdentity is not provided or is true, initialize as an identity matrix
this.m = bMakeIdentity ? [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
}
Matrixhelper.prototype.rotateVect = function (v) {
// Rotate a vector using the matrix transformation
var tmp = new vector3d(v.x, v.y, v.z); // Clone the input vector
v.x = tmp.x * this.m[0] + tmp.y * this.m[4] + tmp.z * this.m[8]; // Apply the rotation transformation
v.y = tmp.x * this.m[1] + tmp.y * this.m[5] + tmp.z * this.m[9];
v.z = tmp.x * this.m[2] + tmp.y * this.m[6] + tmp.z * this.m[10];
};

person icon
sven
Registered User
Quote
2024-12-20 20:46:33

I dont understand where you want to rotate your camera?
Camera can be moved by setting its position and rotated by changeing its target..
Probably doable even without script but with built in actions.

person icon
guest_writer
Guest
Quote
2024-12-23 13:24:31

Sven sorry translator translation is crooked


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |