≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Problem with drawn rectangle
Posted by:
(you are not logged in)
Enter the missing letter in: "Intern?tional"
(you are not logged in)
Text:
[quote][b][/b] wrote: Oh, I think I found those errors too: "this" in "this.Col". Also, I kinda changed the script, so, now it makes a little crosshair: [code]/* <behavior jsname="behavior_aim" description="Look how bullet will fly"> <property name="StartPoint" type="scenenode"/> <property name="EndPoint" type="scenenode"/> <property name="Crosshair" type="texture"/> <property name="Crosshair_Size_X" type="float"/> <property name="Crosshair_Size_Y" type="float"/> </behavior> */ Pos2D = 0; behavior_aim = function() { }; behavior_aim.prototype.onAnimate = function() { var SP = ccbGetSceneNodeProperty(this.StartPoint, "PositionAbs"); var EP = ccbGetSceneNodeProperty(this.EndPoint, "PositionAbs"); var Col = ccbGetCollisionPointOfWorldWithLine(SP.x, SP.y, SP.z, EP.x, EP.y, EP.z); if (Col == null) { Pos2D = ccbGet2DPosFrom3DPos(EP.x, EP.y, EP.z); } else if (Col) { Pos2D = ccbGet2DPosFrom3DPos(Col.x, Col.y, Col.z); }; function onFrameDrawing() { ccbDrawColoredRectangle(0x35ffffff, Pos2D.x - 30, Pos2D.y - 2, Pos2D.x - 10, Pos2D.y + 2); ccbDrawColoredRectangle(0x35ffffff, Pos2D.x + 10, Pos2D.y - 2, Pos2D.x + 30, Pos2D.y + 2); ccbDrawColoredRectangle(0x35ffffff, Pos2D.x - 2, Pos2D.y + 10, Pos2D.x + 2, Pos2D.y + 30); } ccbRegisterOnFrameEvent(onFrameDrawing); }[/code] This is better than a red square in the center, so, this would be good! [img]https://i.postimg.cc/QCNfWyDS/image.png[/img][img]https://i.postimg.cc/3xQDSD4Q/image.png[/img][/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