Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
shoot from mouse?

spicymilk
Registered User
Quote
2023-06-21 00:08:29

I've got no idea how I would do that


VP
Guest
Quote
2023-06-21 00:31:49

Add a behaviour "when key pressed" (left mouse click)
Do action "Shoot" (towards camera target).


spicymilk
Registered User
Quote
2023-06-21 01:38:10

I mean like where you can move the mouse around on the screen while the camera is still and shoot from that position


VP
Guest
Quote
2023-06-21 12:01:46

You can probably use the "Get 3D position from 2D position" API to convert the mouse position to a real-worl 3D target. ccbGet3DPosFrom2DPos(x,y) Then use the 3D position as the target for the shoot action.

example:
var mouseX = ccbGetMousePosX();
var mouseY = ccbGetMousePosY();

var anode = ccbGetSceneNodeFromName("somenode");
var pos3d = ccbGet3DPosFrom2DPos(mouseX, mouseY);
ccbSetSceneNodeProperty(anode, "Position", pos3d);


spicymilk
Registered User
Quote
2023-06-21 19:44:26

Thanks I'll try this.


Create reply:


Posted by: (you are not logged in)


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