Jump to content

Photo

setpos and mesh collisions

setpos mesh collision mesh collision gravity physic tank drivable

  • Please log in to reply
1 reply to this topic

#1
nonplusultra

nonplusultra

    Enthusiast

  • Premium Member
  • 120 posts

hey guys, I'm working on a drivable tank, everything works fine, it is moving, turning, just the basics which work wonderful, if there wouldn't be the problem with the collision.

 

I know about that if using setpos the mesh won't be updated until dis-/enabled or moved with moveto, but even with dis-/enabling with a parent doesn't solve the problem, because the mesh doesn't have the time to get out of the underground before the next frame is moving it deeper in...

I had to set the quest delay to 0.01 for an unlaggy movement.

I've even tried it with a small invisible ghoul that is following the player and where the tank base is set it's height to, works a tiny little bit, but far away from having a good solution!

I know about some other mods, where they seem to have fixed the problem, but I don't want to copy from other mods.

 

So you are asked, if having a good idea/script to help me.

 

Here's the script, it's a messy one atm because it is in testing phase and it's just the basic.

 

 

scn NecroTankSCRIPT

ref tank
float px
float py
float pz
float tz
float ppx
float ppy
float ppz
float ax
float ay
float az
float punit
float ta
float physixx
float physixy
ref colparent
ref physix

short drivemode

begin gamemode

if drivemode == 1
tank.setscale 0.5
set pz to tank.getpos z + 120
set py to player.getpos y
set px to player.getpos x
player.setpos z pz
set ta to tank.getangle z
set ay to player.getangle y
set ax to player.getangle x
set colparent to tank.placeatme tankbase
colparent.setscale 0.5
tank.setangle z ta
tank.setangle y ay
tank.setangle x ax
tank.setpos z pz
tank.setpos y py
tank.setpos x px
colparent.setangle z ta
colparent.setangle y ay
colparent.setangle x ax
colparent.setpos z pz
colparent.setpos y py
colparent.setpos x px
colparent.disable 0
disableplayercontrols 1 1 1 0 0 0 0
set physix to tank.placeatme necrophysixghoul
physix.setghost 1
set pz to physix.getpos z
set drivemode to 2
endif

if drivemode == 2 && (iskeypressed 17)
set punit to punit + 3
set ppx to - (cos ta * punit)
set ppy to (sin ta * punit)
set ppy to py + ppy
set ppx to px + ppx
set ppz to pz - ppz
set pz to physix.getpos z + 60
set physixx to physix.getangle x
set physixy to physix.getangle y
player.setpos y ppy
player.setpos x ppx
tank.setpos y ppy
tank.setpos x ppx
tank.setpos z pz
tank.setangle x physixx
tank.setangle y physixy
colparent.setpos y ppy
colparent.setpos x ppx
set pz to tank.getpos z
set py to tank.getpos y
set px to tank.getpos x
set punit to 0
endif


if drivemode == 3 && tank.getdisabled
colparent.disable 0
tank.enable 0
tank.placeatme DLC03PowerworksFakeForceBall01
set drivemode to 2
endif

if drivemode == 2 && (iskeypressed 32)
set ta to tank.getangle z + 1
tank.setangle z ta
endif

if drivemode == 2 && (iskeypressed 30)
set ta to tank.getangle z - 1
tank.setangle z ta
endif

if drivemode == 2 && (iskeypressed 31)
set punit to punit - 3
set ppx to - (cos ta * punit)
set ppy to (sin ta * punit)
set ppy to py + ppy
set ppx to px + ppx
set ppz to pz - ppz
player.setpos y ppy
player.setpos x ppx
tank.setpos y ppy
tank.setpos x ppx
set pz to tank.getpos z
set py to tank.getpos y
set px to tank.getpos x
set punit to 0
endif

end

 

 

 

Thanks in advance for any help!


Edited by nonplusultra, 28 February 2013 - 11:31 AM.


#2
nonplusultra

nonplusultra

    Enthusiast

  • Premium Member
  • 120 posts

no one an idea? :<







Also tagged with one or more of these keywords: setpos, mesh, collision, mesh collision, gravity, physic, tank, drivable

IPB skins by Skinbox
Page loaded in: 1.096 seconds