Hello i have a problem. As you can see in the video, the two ends of the wood thing dont parent correctly because the thing in the middle is not scaled [1,1,1]
Is there a way around this?
I thought of making Empties and Vertex Parent them to the middle part (But then the 2 dont rotate at all)
apply scale of parent?
Ahh I see.
You are scaling the gfx mesh.
Add a empty, compound root object, parent all shapes to this.
you can use local space to the empty to spawn in the end caps.
empty = own.scene.addObject("Empty", beam, 0)
empty.localScale = [1,1,1]
# set x y z yourself
Local = empty.worldPosition + empty.worldOrientation*Vector(X, Y, Z)
endcap = own.scene.addObject("endcap", empty, 0}
endCap.worldPosition = Local
but then they would be too long
What are too long the endcaps?
Use 2 objects, place the endcaps using math.
If the beam starts out 2 unit long, and the center is the origin,
We can count on the scale being 1 scale unit = 1 blender unit from origin.
So we can use beam.localScale() to get the data to plug into local.
What blender version? I reported this bug a few months ago, and it was patched.
yes the endcaps. the middle part is initially an [1,1,1] cube
UPBGE 0.1.7, i’ll try with 0.1.8
edit: also in 0.1.8
@BPR @ your edit:
i think i understand what you mean, i’ll try it out
Nice it worked with that @BPR
Nice looking mechanic btw.
I thought interactable Environment is pretty fun so i want to add more
I noticed some weird hitboxes while i destroyed more and more wooden beams (see example pic)
Now i found out that that these are the hitboxes that i compounded before! So whenever i spawn the empty the compound mesh was saved.
So i have to remove Parent before i despawn every hitbox, but this doesnt work when i shoot down another beam while another is falling.
Should i use reinstancePhysicsMesh or something when i spawn the empty?
ok reinstancePhysicsMesh apparently doesnt work with compound meshs
I suggest to use a complete different approach.
A) A broken bar is still a bar
B) The broken bar can be of any length
C) The caps of a bar should visually not be scaled
D) The caps of the bar are part of the physics representation.
I suggest following structure:
One bar as physics representation (invisible). It spans the complete dimension (incl. caps). You can change size by scaling the width.
The visual representation has three parts: The dynamically scaled middle part, and two non-scaled end caps. They are all ghosts!
When assembling the bar you create the physics bar and parent the other objects to it.
this is a bug
all object copies using compound have the shapes of all copies in scene with children parented.
run through scene, build list of all objects using that compound physics root shape
for each of these, store a list of children and unparent all children
add new instance to the scene
reparent all objects.
See https://developer.blender.org/T50806 and https://developer.blender.org/P444
I suppose I should apply the patch to UPBGE and submit a pull request…
thanks sdfgeoff !!
could you look at the compound core issue?
I was thinking each compound root/core should have it’s own physics info*
It wasn’t me who did the work. I just reported it.
Unfortunately it hasn’t been merged into normal BGE, but I’ve just created a pull request for UPBGE: https://github.com/UPBGE/blender/pull/534
But as the proper developers are working on the eevee integration, it may be a while before it gets into a release. And they may well decide it should be accepted into normal BGE rather than submitted to UPBGE. Eh, let’s see what happens.
your first solution has the problem that there is again a scaled parent xD
the second i have to look into as i dont know how to do that
thats something i could do
wow that fix would be the easiest solution…
how can i apply this patch? i’m not familiar with GitHub
But you parent after scaling. This should not be an issue. But I do not know. You had it already as you showed us.
no its the same
now solved it with BPR’s solution
but it would be really much easier if i could use that bug fix from sdgeoff xD