problem with raysensor hitPosition

Hi :eyebrowlift:
having trouble get this work


import bge 
 
cont = bge.logic.getCurrentController() 
 
own = cont.owner 
 
own.worldPosition = cont.sensors["RAYSENSOR"].hitPosition

maybe something wrong with that code ?

a empty cast a ray in Z- (to the ground)
ray hit ground
assign the hitPosition to the empty (teleport to ground)

the problem:
the empty snaps down to the groundplane - but always at X, Y at 0
in the center of the world

i cant see or find the problem for hours - any help or tipp would be great… :yes:
thx
Tobi

I do not see a problem with your code

i found it - problem was not the code

the first thing - with XRAY on i dont get the hitPosition back - hmm strange
but thats okay for now - i can switch it off

second
i do more testing at the moment to get my underwater automatic bubble emitter effect working like i want it :smiley:

what i basicaly try to do - to have an object around my underwater-boat that spawn bubbles in the distance.
so when i drive i have that bubbles all around me

  • bubble partikel object (hidden)
  • bubble emitter spawn some random bubbles and ends itself (hidden)
  • some emptys around the player - following him - align to ground - and spawn the bubbleemitters

after 10 hours now it works - but not exactly like i want it - cant copy location of the player to the emptys per py - that fails
they stay at world center
i use an new empty that copy loc of player - and i parented the emitter_spawner to that new empty
that had not worked

now i tryed vertex parent - and that works :slight_smile: yea

i go on :slight_smile: