≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Camera shake action for explosions
Posted by:
(you are not logged in)
Enter the missing letter in: "Internati?nal"
(you are not logged in)
Text:
[quote][b]Des[/b] wrote: // Set the duration of the shake effect (in milliseconds) var shakeDuration = 1000; // Set the intensity of the shake effect (in pixels) var shakeIntensity = 10; // Get a reference to the camera object var camera = CopperCube.getScene().getActiveCamera(); // Get the camera's initial position var startX = camera.getPositionX(); var startY = camera.getPositionY(); var startZ = camera.getPositionZ(); // Define the easing function to use for the shake effect var easingFunction = CopperCube.Easing.ElasticOut; // Start the shake effect CopperCube.getScene().startAction(function (elapsedTime) { // Calculate the current shake intensity var shakeX = (Math.random() * shakeIntensity * 2 - shakeIntensity) * easingFunction(elapsedTime / shakeDuration); var shakeY = (Math.random() * shakeIntensity * 2 - shakeIntensity) * easingFunction(elapsedTime / shakeDuration); var shakeZ = (Math.random() * shakeIntensity * 2 - shakeIntensity) * easingFunction(elapsedTime / shakeDuration); // Set the camera's position to the new, shaken position camera.setPosition(startX + shakeX, startY + shakeY, startZ + shakeZ); // End the shake effect after the specified duration has elapsed if (elapsedTime >= shakeDuration) { return false; } return true; });[/quote]
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