Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Announcements and Showcase
Any translational camera shake

Sike
Guest
Quote
2023-03-26 18:01:38

Can anyone create a headbob camera effect behaviour or action


sakura
Registered User
Quote
2023-03-26 18:07:37

You can wait for the next version of my function library to be updated.

Or you can use the GetEndPoint function in my library to calculate the camera offset at any angle and implement camera shake

https://ambiera.com/forum.php?t=...


Chester
Guest
Quote
2023-03-26 18:14:00

Sakura, windows defender blocked the application , saying that there was a trojan inside of it and other viruses.

So basically, I don't trust your application


sakura
Registered User
Quote
2023-03-26 18:20:08

The function library is a JavaScript file, not an exe.

If you don't use the ReadCCBinFile function, you don't have to download the bin2cc tool.


sakura
Registered User
Quote
2023-03-26 18:22:10

Chester wrote:
Sakura, windows defender blocked the application , saying that there was a trojan inside of it and other viruses.

So basically, I don't trust your application


You can download the latest version, the archive doesn't contain any exe.

https://ambiera.com/forum.php?t=...


sakura
Registered User
Quote
2023-03-26 18:54:54

Zimba wrote:
Dear Sakura , the greatest developer of the community. I admire your work but it gets detected as virus "Virus", I am not going to download it too, sorry buddy. Maybe you should try to upload your file to virus total definations and mark it a false safe. Btw, an easiest way to do head bobbing without the code or anything is simply make the camera children of an animated mesh.

One day I will become the greatest dev here sakura, just wait and watch. You will be my competitor. only you are in the game. everybody else are just noobs. Hehehehe


That's really quite unfortunate. In fact the archive is impossible to run, if you have downloaded it once you know it is safe, Windows Defender is not very reliable, you can scan my files online and I don't think there will be any problems.


Des
Guest
Quote
2023-03-26 22:41:31

Sakura can you pls show me how to use the get end point for camera shake, pls make it simple I'm not good at programming


sakura
Registered User
Quote
2023-03-27 18:16:30

Des wrote:
Sakura can you pls show me how to use the get end point for camera shake, pls make it simple I'm not good at programming


ccbRegisterOnFrameEvent(OnFrame);
var frame = 0;
var flag = true;
function OnFrame()
{
if(frame >= 3)
{
frame = 0;
flag = !flag;
}
var camera = ccbGetSceneNodeFromName("camera");
var pos = ccbGetSceneNodeProperty(camera, "Position");
var rot = ccbGetSceneNodeProperty(camera, "Rotation");
var endPoint = Sakura.GetEndPoint(pos, rot.x, rot.y + (flag ? 90: -90), 2);
ccbSetSceneNodeProperty(camera, "Position", endPoint.x, pos.y, endPoint.z);
var target = Sakura.GetEndPoint(endPoint, rot.x, rot.y, 100);
ccbSetSceneNodeProperty(camera, "Target", target.x, target.y, target.z);
frame++;
}


This is a simple camera shake that supports horizontal shake with no complicated formula. If you add some variables to control it, you can shake the screen when you need to, I hope you will like it.

🔎︎



sakura
Registered User
Quote
2023-03-27 18:26:50

The basic idea is to find out the Position of both sides according to the current camera position, and then find out the Target according to the new Position and the original Rotation. so that no matter how you rotate, you can shake the screen horizontally.


Des
Guest
Quote
2023-03-29 05:38:42

So should I execute as javascript


sakura
Registered User
Quote
2023-03-29 16:50:46

Des wrote:
So should I execute as javascript


Yeah, if you mean in no code way.

You need to switch to the Behaviour tab first, then click the Add button and select Scripted behaviors->Sakura Function Library.

Then add Before first drawing do something, add Special->Execute Java Script in Action, paste the code in, and run the game to see the effect.

Remember to change your camera name to "camera" or change the camera name in the code.


sixvivid
Registered User
Quote
2023-03-29 17:46:21

@sakura I could really really use your help with some things like this would you please join my discord server to speak further about this


sakura
Registered User
Quote
2023-03-29 18:09:15

wrote:
@sakura I could really really use your help with some things like this would you please join my discord server to speak further about this


I'm sorry. I don't have much time, but you can post a description of the problem in the forum and I'll reply to you if I have time.


sakura
Registered User
Quote
2023-04-02 20:48:57

My function library has been updated.

It fixes the GetEndPoint function Z-axis direction, so I changed the parameters of the GetEndPoint function in this post.

If you want to test this code, you need to download the latest version of the function library.

You can check this link for details.
https://ambiera.com/forum.php?t=...

Of course, now my function library already comes with the shake camera function, you can use it directly.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (you are not logged in)


Text:

 

  

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


   






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