Rigid bodies not effected by rotation of static object

So I have this problem where I have a rotating static object and I want that object to pull the rigid bodies with it, but currently, the rigid bodies just sail along it. How can I fix this problem?

when the thing hits the object store it’s local

each frame use the local + fake linv to move the player

import bge 
cont = bge.logic.getCurrentController()
ray = cont.sensors['Ray']

if ray.positive:
if 'local' not in player:
    diff = ray.hitPosition-ray.hitObject.worldPosition
    player['local']=[ray.hitObject, ray.hitObject.worldOrientation.inverted()*diff ]
else:
    player.worldPosition = player['local'][0].worldTransform*player['local'][1]+player.worldOrientation.col[0]*own['speed']+player.worldOrientation.col[2]*player['rise']

where speed is your forward velocity, and ‘rise’ is falling / jumping

Can you explain a bit more? I’m a bit of a beginner.

Increase the friction of the objects. (on the physics panel if you’re on UPBGE or the Materials panel if you’re on BF BGE).

I think the problem may be the speed the object is rotating at and it’s size. It’s pretty much a planet, rotating at 0.01 but it wont pull things with it.

I’ve tried increasing the friction and even having it at 100 doesn’t work

yeah,

basically by storing a local, and applying it next frame
you move relative to the planet

offsetting the position each fame and adding your own speed and fall/rise value and storing new local ends up like this

here is something for you from scratch to be ran in player

import bge

cont = bge.logic.getCurrentController()
player = cont.owner

planet = player.scene.objects['planetName']

if 'local' not in player:
    #store the players location relative to the planet
    diff = player.worldPosition-planet.worldPosition
    player['local']= planet.worldOrientation.inverted()*diff
else:
   #place player relative to planet even if it has moved
   player.worldPosition = planet.worldTransform*player['local']
  #store [distanceToplanet,vet2planet,etc]
   v2=player.getVectTo(planet)
   #point feet to center of world
   player.alignAxisToVect(v2[1],2,.5)
   ray = player.rayCast(planet.worldPosition,player.worldPosition,0,'',0,0,0)
   #this is used to align to terrain and to reset fall
   if ray[0]==planet:
       player.alignAxisToVect(ray[2],2,.5)
       if player.getDistanceTo(ray[1])<player['Height']/2:
           player['Rise']=0
           player.worldPosition=ray[1]+ v2[1]*player['Height']/2
       else:
           player['Rise']-=9.8
   player.worldPosition+=player.worldOrientation.col[0]*player['speed']
   player.worldPosition+=v2[1]*player['Rise']

I will need to run / debug if I get a minute

I mean the python, I’ve just started learning, thanks so much for answering though :)))

Thanks! Sorry for all the questions but I really want to get this to work!

working demo :smiley:

WASD


import bge


cont = bge.logic.getCurrentController()
player = cont.owner


planet = player.scene.objects['Planet_Bob']
W = cont.sensors['W']
S = cont.sensors['S']


#speed controller
if W.positive and player['Speed']<=9.995:
    player['Speed']+=.005
elif S.positive and player['Speed']>=-9.995:
    player['Speed']-=.005
        
        
        
#friction kinda         
elif abs(player['Speed'])>=.0025:
    if player['Speed']>0:
        player['Speed']-=.0025
    else:
        player['Speed']+=.0025    
        
        
        
if 'local' not in player:
    #store the players location relative to the planet and initalize some values
    player['Height']=2
    player['Speed']=0
    player['Rise']=0
    
    diff = player.worldPosition-planet.worldPosition
    player['local']= planet.worldOrientation.inverted()*diff
else:
    #place player relative to planet even if it has moved
    player.worldPosition = planet.worldTransform*player['local']
    #store [distanceToplanet,vet2planet,etc]
    v2=player.getVectTo(planet)
    #point feet to center of world
    player.alignAxisToVect(v2[1],2,.5)
    ray = player.rayCast(planet.worldPosition,player.worldPosition,0,'',0,0,0)
    #this is used to align to terrain and to reset fall
    if ray[0]==planet:
        player.alignAxisToVect(ray[2],2,.125)
        d = player.getDistanceTo(ray[1])
        if d<player['Height']:
            player['Rise']=0
            player.worldPosition=ray[1]+ v2[1]*-player['Height']/2
        else:
            player['Rise']+=1
            
    #Continious Collision Detection forward/back        
    end =  player.worldPosition + player.worldOrientation.col[0]*player['Speed']
    ray2 = player.rayCast(end,player.worldPosition,0,'',0,0,0)
    if ray2[0]:
        player.worldPosition = ray[1]+player.getVectTo(ray[1])[1]*-player['Height']/2   
    else:
        player.worldPosition+=player.worldOrientation.col[0]*player['Speed']
   
    
    
    
    #Continious Collision Detection up/down
    end = player.worldPosition + v2[1]*player['Rise']
    ray3 = player.rayCast(end,player.worldPosition,0,'',0,0,0)
    
    if ray3[0]:
        
        player['Rise']=0
        player.worldPosition = ray3[1]+v2[1]*-(player['Height'])
    else:
        player.worldPosition+=v2[1]*player['Rise']    
        
    #Update Local    
    diff = player.worldPosition-planet.worldPosition
    player['local']=planet.worldOrientation.inverted()*diff
   

Attachments

LocalMovement.blend (588 KB)