I am trying to create a dynamic mesh creation by using
GetDynamicMeshElements().
I have a struct that is derived from FPrimitiveSceneProxy, Overriding virtual functions GetDynamicMeshElements() and GetViewRelevance() to turn on bDynamicRelevance to be true.
This FStruct’s instance will be returned from a virtual fucntion override for CreateSceneProxy() which is in a class that is derrived from UPrimitiveComponent.
I have this class that is derived from UPrimitiveComponent in my Actor derived class but the GetDynamicMeshElements() is not called…
I must have missed something, would there be any reference show how to use this property correctly?
Did you confirm through the debugger that your render proxy is actually being created? If it’s not it may be that your component or its parent actor is set to be not visible.
If it is being created but the GetDynamicMeshElements method is not called, it would appear to be related to GetViewRelevance, or maybe CalculateBounds.
There are loads of examples of this in the engine source code. Look at, for example, FDebugRenderSceneProxy.
Result.bDrawRelevance = IsShown(View) && (IsSelected() || View->Family->EngineShowFlags.Navigation);
This is set up to only draw if the component is selected, or if navigation visualisation is selected in the viewport’s ‘Show’ menu. Could that be the problem or is this intentional?
Yes, but I think bDrawRelevance will override bDynamicRelevance, and currently that will be set to false in the conditions I mentioned above.
Try using just
I tried it and even Result.bDynamicRelevance = true; but it still seems to not load it… I am using 4.5.1 and they say that GetDynamicMeshElements is not used for default path. I have to turn on something in DefaultEngine.ini but the parameter is not given. I don’t know which parameter to switch that on. or else.
Ah okay, I was assuming you were using the latest version. I’m not certain, but I believe pre 4.7 you may want to override DrawDynamicElements rather than GetDynamicMeshElements.
This link which someone posted in the 4.7 transition thread may be useful to you. It shows an example of the differences in implementing this behaviour pre and post 4.7.
If I toggle r.UseGetDynamicMeshElements 1, it seems to be visible in editor, I have to see this in game as well. Well, at least I am on the right way. Thanks Kamrann!