Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Player Rotation

rolevix
Registered User
Quote
2017-06-24 12:55:35

How to make Rotation of node on Mouse Move?

For example:
If you move mouse left, your node (player) rotate to left too.

I need to make rotate player to left/right via mouse and just look camera to up and down (using third person camera)
(Cause turn player via keyboard actually don't easy in action games)


eminem100
Guest
Quote
2017-06-25 11:40:12

Its difficult to do it with the present functions, hope NIKO has some solution for it.........



just_in_case
Moderator
Quote
2017-06-25 12:49:31

I think its pretty easy... All you have to do is script a beahviour... Which changes rotation of the player by +1or +10 or any value you want... When mouse is moved in the negative x axis....

And same is for rotating the player clockwise... Just change the rotation to -1 or -10 or any value you want .. when mouse is moved in the poisitve x axis...

That have to be scripted as per on frame event...its a little bit same as drawing custom... Mouse... But in this.. we dont draw custom... Mouse and change its position according to the real mouse...

This time we rotate the player node with the real mouse cursor..

Hope you understand this..



Or if you want maybe i can try to make this behaviour for you..


rolevix
Registered User
Quote
2017-06-25 15:06:51

I'm not a programmer :(

Also i would be very grateful to you if you can help me


Zoo
Guest
Quote
2017-06-25 15:56:32

Try the behavior, every few seconds eg, 200 milliseconds then add the action, rotated to fixed position, it should work for the animated character behind the arms... But it might come with a high performance cost


Zoo
Guest
Quote
2017-06-25 16:04:03

Woops , it is called "set absolute rotation"


rolevix
Registered User
Quote
2017-06-25 16:48:14

Nope, i work with CCB since 2013, i make more games with that engine and i know what features CAN'T MAKE WITH STANDART BEHAVIORS.
But i know, it can be possible with JS,so... i don't know JS...


just_in_case
Moderator
Quote
2017-06-25 18:05:15

@zoo he is asking to rotate the player model relatively with mouse movement...... Which is not possible with inbuilt standard behaviours....

For that you have to script another behaviour...


Zoo
Guest
Quote
2017-06-25 19:50:04

Sorry can't help, I don't know much maths, I am a coder...but cannot work in 3D, only 2D Maths


eminem100
Guest
Quote
2017-06-26 11:11:44

There is one way if you are doing this with webgl, first, use vanillaJS, use var x = x_capture_mouse_pos();
var y = y_capture_mouse_pos();
then, the variables will tell you the x and y pos, all you need is to implement this to the game. for ex, the player will point to x on the screen, and y on the screen. Hope I could be able to make you understand.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "I?ternational" (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