Re: Disc component

Avatar
  • updated
  • Not a bug

I have a prefab that used Disc component. I am currently using Runtime Tools Editor asset. It has a BoxSelectionRenderer component that trying to find every renderer in the scene and get a selection from it. 

Image 367

Image 368

After going through this code, the Disc would not draw anything on the screen. Do you have any idea what might go wrong here?

Thanks.

Reporting a bug? please specify Unity version:
Unity 2020.3.3f1c1
Reporting a bug? please specify Shapes version:
3.2.3
Reporting a bug? please specify Render Pipeline:
URP
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Not a bug

sounds like some of the Shapes properties might be getting dropped or something, or that the reference to the property block in Shapes is broken

mind that I won't be designing shapes with third party plugins in mind, so I probably won't change anything I'm afraid! things are set up the way they are now for performance reasons, and I think changing it to support this would come at a cost

As for drawing without using scale - scale is always applied since it's part of the matrix, but you can temporarily set scale to 1 if you want to draw "unscaled":

Draw.LocalScale = Vector3.one;
Avatar
Freya Holmér creator
Quote from yoonack

Sorry to bother you again, is there a way of queueing multiple draw command to ImmediateMode component? I need to call Draw.Line() from different part of my code at update();

sorry for super late answer

so, kinda, but not really! the complicated part is that Update() fundamentally is disconnected from the camera rendering, which command buffers are linked to. the easiest way to do this is to call functions from other objects inside the draw command, so the other object an keep track of the data, while the draw command is still managing the draw loop

Avatar
yoonack

Sorry to bother you again, is there a way of queueing multiple draw command to ImmediateMode component? I need to call Draw.Line() from different part of my code at update();

Avatar
yoonack

Hi, here is my example code:

Draw.matrix = matrix;

Draw.Line(p1, p2);

if I change the scale in matrix, the line got messed up. However, if do what you said setting Draw.LocalScale = Vector3.one, would the point p1 getting translated corretly?

Thanks

Avatar
Freya Holmér creator
  • Answer
  • Not a bug

sounds like some of the Shapes properties might be getting dropped or something, or that the reference to the property block in Shapes is broken

mind that I won't be designing shapes with third party plugins in mind, so I probably won't change anything I'm afraid! things are set up the way they are now for performance reasons, and I think changing it to support this would come at a cost

As for drawing without using scale - scale is always applied since it's part of the matrix, but you can temporarily set scale to 1 if you want to draw "unscaled":

Draw.LocalScale = Vector3.one;
Avatar
yoonack

Yeah, it is third party tool for drawing Runtime Handles. I just have no idea why this block of setcolor code breaks the Disc drawing.

Btw, I am wondering how to let the Draw command use draw.matrix without using scale inside matrix. Instead, I want it to use the translating and rotation inside that matrix?

Avatar
Freya Holmér creator
  • Under Review

I'm not sure what this runtime tools thing is, is it a third party asset?

Avatar
yoonack

I think I found out where the problem is

renderer.SetPropertyBlock is causing the Disc renderer to fail. I don' know why this would happen.