Answers is deprecated.

Please use Forum to participate in community by asking and answering questions!

Hello,

I'm wondering if PlayCanvas have something to draw simple lines or circles. I want to use it for debugging purposes. I'm just looking for something similar to Unity's API -> Debug.DrawLine or similar.

If Playcanvas doesn't have this feature, I would appreciate if somebody could propose a similar approach.

Thanks in advance!

asked 28 Dec '16, 22:50

sortegam's gravatar image

sortegam
5113
accept rate: 0%

edited 28 Dec '16, 23:01


You need the pc.Application#renderLine function.

link

answered 29 Dec '16, 12:49

will's gravatar image

will ♦♦
5.7k11224
accept rate: 46%

Great! And for circles? I did not found anything like this in the Docs.

(29 Dec '16, 13:01) sortegam

For that, you just need Math.sin and Math.cos and the renderLine function if you want to do circle outlines. If you want to render filled circles, you could use a plane with an alpha texture. Or you could model a circle in a 3D app like Blender/Max/Maya and import as FBX. Or you could procedurally create a pc.Mesh with the pc.createMesh function: http://developer.playcanvas.com/en/api/pc.html#createMesh

(29 Dec '16, 13:05) will ♦♦

Thanks a lot for the explanation!

(29 Dec '16, 23:10) sortegam
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×4
×4
×3
×2
×1

Asked: 28 Dec '16, 22:50

Seen: 1,036 times

Last updated: 29 Dec '16, 23:10

about | privacy | support | contact

playcanvas