Intermediate python help,

So I have the original component cube, (see file below)

I need to have collision with a invisible empty box with the property “snap” trigger casting 4 rays on the side of the cube that faces away from the player, if all 4 hit the another 4 “terminal faces” I need the block in the players hands parent a empty that is it’s “6dof” target to the other cube.

So

  1. Collision with Snap
  2. Cast 4 rays
  3. rotate cube in players hands to Align all faces
  4. parent “6dof Center empty” to the cube that was targeted by the player


Update
.blend
with 6dof target empties etc

Attachments

SnapToTarget.blend (716 KB)

0 views?

please help?

Your demo file looks pretty good. Analyzing it …

Do you mean?

The left “cube.000” detected the right “cube.001” (with this ray method)?

Then the left empty “6dof center empty” should be parented to the right empty “6dof center empty.001”?

If that is the case:
How does the left cube knows about the left empty?
How does it know about the right empty?

Yes, and I that is what I need help with, as own.parent is easy to get but I don’t know how to get " own.rigidBodyJointTarget "is there a func call for that?

also it aligns the cubes rotation so the “terminal faces” are parallel on that side, and X distance apart before the parent is initiated,

If this does not exist "own.getRigidBodyJointTarget"It would be nice if it could

other neat one would be - own.setRigidBodyJointOffset and own.getRigidBodyJointOffset

I have been digging though documentation, and I don’t know where to go from here

Bumpdate - Still need help

If that is the case:
How does the left cube knows about the left empty?
How does it know about the right empty?

The rays cast, all detect faces that are terminal faces already, and pass data by editing a property associated with that terminal face, I just need another mode that sets the parent instead of passing data,

there too many code to understand

object[polyProperties[item]] = “Empty”
object[‘hostID’] = 0
object.state = 1
hitOb.setParent(object) # ??

just random code

Right now the component cube works like this,

if any “FaceProperty_X” != Empty (we will say Empty = “Test”)
then cast a ray from
FaceIndex_X face

if it strikes another indexed face, then change that faces property to “Test” and set it’s own face property back to empty

This works now, to pass a property around, like power, or player position or ???

What I need is the same system to be used in the snap code,
if you can help clean it up as well more power to you,

HostID has almost been completely depreciated, originally It took the place of “FaceProperty” but could not be used to cast rays from a list, I had some help from kevin to make it how it is now,

I think I know how to do the link code now though, have the component cube spawn the empty on creation and then it knows it’s 6dof constraint target, because it sets it up right then, since I can not check what the target is with python :slight_smile:

now I just need help…
check this file out maroIT,
I am not half the coder you are,
I know you can understand this, it’s just a little chaotic…
just like me:)

Attachments

Cubix (4).blend (757 KB)

Please download both .blends, and take a look at the intent of the item, not the code, then after you understand what I am hoping to achieve, help me to better clarify what is going on by commenting the script better,
and then we can remove all that has been depreciated,

Cubix works to pass data,

just not to parent cubes,

I think I have the issue solved of knowing the constraint target, I will just have the cube spawn the static empty that is it’s 6d0f handle, and then set up the RBJ, and store the key of it’s empty @ this point, since I can’t do it pre-runtime,

Then when the cube collides with a property - “snap” it will cast rays from the opposite side of the player, if all 4 hit another “set of terminal faces” then align the " Held cube" empty and the “Target cube”, and parent the “Held cube’s” empty to the “Target cube’s” empty

essentially we are making a dynamic version of minecraft, many components will not need the 6dof constraint target empty, but some will… so this is the last piece, before you can move blocks, and build systems in game that are 3d logic bricks…

Attachments

TripGun (2).blend (758 KB)

see this , maybe help

this use the ray to make constraints on the fly.(more or less is wath you ask right?)
is of course a lot more easy , is sufficient that a obj have a property “RBJTARGET” to be a valid target.

PS : not make things too over your skill , try to make “a bit” over, not too, otherwise is a impossible…
plus : the code also well written in ever hard to read for other.:yes: (well ,also 50 bricks anyway)
:wink:

Attachments

constraintWithRay.blend (58.6 KB)

why not put in the first post of the TD the last blend? as “demo” ,choose “compress” when you save the file , to make the blend more little…
i see some good images , but not more ,i not read “well” the english ,