≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
help me in this script
Posted by:
(you are not logged in)
Enter the missing letter in: "?nternational"
(you are not logged in)
Text:
[quote][b]jhinsk[/b] wrote: behavior_CameraZoomByMouseButton = function() { this.targetZoomValue = 90; this.LastTime = null; }; // called every frame. // 'node' is the scene node where this behavior is attached to. // 'timeMs' the current time in milliseconds of the scene. // Returns 'true' if something changed, and 'false' if not. behavior_CameraZoomByMouseButton.prototype.onAnimate = function(node, timeMs) { // get the time since the last frame if (this.LastTime == null) { this.LastTime = timeMs; return false; } var delta = timeMs - this.LastTime; this.LastTime = timeMs; if (delta > 200) delta = 200; // never do movements longer than 200 ms var cam = ccbGetActiveCamera(); var newFov = ccbGetSceneNodeProperty(cam, 'FieldOfView_Degrees'); if (this.targetZoomValue < this.MinZoom) this.targetZoomValue = this.MinZoom; if (this.targetZoomValue > this.MaxZoom) this.targetZoomValue = this.MaxZoom; var localZoomSpeed = this.ZoomSpeed; localZoomSpeed = Math.abs(this.targetZoomValue - newFov) / 8.0; if (localZoomSpeed < this.ZoomSpeed) localZoomSpeed = this.ZoomSpeed; if (newFov < this.MaxZoom-localZoomSpeed && newFov < this.targetZoomValue) { newFov += localZoomSpeed; if (newFov > this.MaxZoom) newFov = this.MaxZoom; } if (newFov > this.MinZoom+localZoomSpeed && newFov > this.targetZoomValue) { newFov -= localZoomSpeed; if (newFov < this.MinZoom) newFov = this.MaxZoom; } ccbSetSceneNodeProperty(cam, 'FieldOfView_Degrees', newFov); } // mouseEvent: 0=mouse moved, 1=mouse wheel moved, 2=left mouse up, // 3=left mouse down, 4=right mouse up, 5=right mouse down behavior_CameraZoomByMouseButton.prototype.onMouseEvent = function(mouseEvent, mouseWheelDelta) { if (mouseEvent == 5) { // right mouse down this.targetZoomValue -= mouseEvent * this.ZoomSpeed; if (this.targetZoomValue > this.MinZoom) this.targetZoomValue = this.MinZoom; if (this.targetZoomValue > this.MaxZoom) this.targetZoomValue = this.MaxZoom; } if (mouseEvent == 4) { // right mouse up this.targetZoomValue += mouseEvent * this.ZoomSpeed; if (this.targetZoomValue < this.MinZoom) this.targetZoomValue = this.MinZoom; if (this.targetZoomValue < this.MaxZoom) this.targetZoomValue = this.MaxZoom; } } i want to change right mouse button to any keybord button please help let sey when user press m key on keyboard if (mouseEvent == 5) { // right mouse down this.targetZoomValue -= mouseEvent * this.ZoomSpeed; if (this.targetZoomValue > this.MinZoom) this.targetZoomValue = this.MinZoom; if (this.targetZoomValue > this.MaxZoom) this.targetZoomValue = this.MaxZoom; } if (mouseEvent == 4) { // right mouse up this.targetZoomValue += mouseEvent * please convert this input to M key on keyboard please please[/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