Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/11/19 in all areas

  1. For long time i considered to do something with physics in mta. For now doing even simplest things such falling box, tree on flat area looks cartoonish. In my history of i saw few attempts of doing simple physics, mostly it was in closed area without bigger interactions with poor performance due you just can't calculate collision in other way than processLineOfSight, isLineOfSightClear or read directly .col file as Tederis did. I started with something to render things, thats how FBX https://github.com/multitheftauto/mtasa-blue/pull/1093 to bypass default rendering to handle future i'll introduce in future. That's how bullet physics project born, first idea how to use react physics, works simillar but is lighter and general smaller project but 0x416c69 suggested to use bullet. I'll use this topic also to prepare long list of features it contains for future copy paste to PR and wiki page The main assumption is to allow for create multiple world with completly independed simulations, get and set detailed information about current step of simulation, fully control how everything is simulated, quality of collision tests, speed and a lot more. i'm trying keep amount of functions low, because if that most stuff is packed into one function. Syntax and name of some function might change in future or along suggestions. Not all properties supports every physics element, some are only get, other set only, however most of them are set/get Current stage: I already implemented function such a: physics physicsCreateWorld() - responsible for creating new world for simulations, return element which will use later. physics-rigidbody physicsCreateRigidBody( shape-type, mixed arguments ) - creates rigid body which is use to simulation bahaviour of non-static shapes, collisions ( currently only few models in mta can do this in simple way ). physics-rigidbody physicsCreateRigidBodyFromModel( model ) - used to create rigid body directly from collision data taken from gta model. physics-static-collision physicsCreateStaticCollision( shape-type, mixed arguments ) - creates static collision which will not move at all ( it is still possible to move it by Lua script ) physics-shape physicsAddShape( shape-type, mixed arguments ) - if you create compound shape, this function let you add more shapes into static collision or rigid body bool physicsSetProperties( any physics element, physics-property, mixed arguments ) - main function to control physics, rigid bodies, static collisions, shapes. Works in simillar way as handling functions. mixed physicsGetProperties( any physics element, physics-property ) - same as above, but getting properties bool physicsDrawDebug( physics ) - use to visualization of world, must be used in render function bool physicsSetDebugMode( physics-debug-mode, enabled ) - use to turn off/on debugging features bool physicsBuildCollisionFromGTA( physics ) - used to create static collisions in specified world from original collisions, doesn't create whole world instantly, require to move player around world to load collision data. physics-constraint physicsCreateConstraint( physics, physics-rigid-body, physics-rigid-body, constraint-type, mixed arguments ) - use to connecting two or more rigid bodies into one entity bool physicsApplyForce( physics-rigid-body, vector from, vector to ) - pushing rigid body in particular point you choosed. bool physicsApplyCentralForce( physics-rigid-body, vector direction ) - apply force from central position of rigid, it's more like "accelereate", should be used more than once at the some period of time bool physicsApplyCentralImpulse( physics-rigid-body, vector direction ) - setting position from center of rigid bool physicsApplyDamping( physics-rigid-body, float force ) - i'm not sure, but it should slow down velocity and rotation of model by specified amount of units physicsApplyImpulse( physics-rigid-body, vector direction ) - i'm not sure how it works physicsApplyTorque( physics-rigid-body, vector rotation ) - same as physicsApplyCentralForce but for rotation physicsApplyTorqueImpulse( physics-rigid-body, vector rotation ) - setting rotation speed physics-properties: "mass", "position" ,"rotation", "sleepingthresholds", "restitution", "scale" "debugcolor", "filtermask", "filtergroup", "stiffness" `sleepingthresholds` means how slow rigid must move/rotate to sleep, it makes stops moving at all but still can be pushed by other rigids `restitution` bounciness, between 0-1 but accept any value above `stiffness` - for fixed constraint `filtermask` i still figuring out how it work, but should let you use 32 bit mask to set which rigid with which should collide Bullet documentation: https://github.com/bulletphysics/bullet3/blob/master/docs/Bullet_User_Manual.pdf page 13 contains useful information when which shape should be used physics-constraints: "pointtopoint", "hidge", "fixed", "slider" Physics-shapes: "box", "sphere", "capsule", "cone", "cylinder", "heightfieldterrain", "compound", "trianglemesh", "convexhull" `compound` is used for constructing rigid made of various shapes Plans for future: "heightfieldterrain" shape type accept black-white texture for faster creation Support for cloths, soft bodies Media: Videos are availiable at my youtube channel https://www.youtube.com/channel/UC95MpsQ1JppDNpMvl_7c1rg screenshots and gifs of current progress: Documentation i use: https://pybullet.org/Bullet/BulletFull I'm waiting for your suggestions Topic not finishedd
    1 point
  2. Pra fazer uma verificação do veículo armazenado na tabela: if veh[getPedOccupiedVehicle(player)] then print("é um veículo da tabela") end Se o intuito dele não for fazer nada disso, então ele está usando uma estrutura errada para a tabela.
    1 point
  3. veh = {} for i=1,30 do veh[createVehicle(481, 1505.42102 + i, -1753.69446, 13.54688)] = true end
    1 point
  4. Por favor, antes de criar um tópico nesta categoria, certifique-se que o seu tópico esteja de acordo com cada uma destas etapas: Formule sua pergunta corretamente Coloque um bom título para o seu tópico. Não intitula o seu tópico com: Ajuda por favor; Dúvida; Alguém me ajuda?; Como faço isto? Em vez disso, você pode deixar especificado o que você precisa no título do tópico. Detalhe sua dúvida para que possamos entender o seu problema melhor Tente informar onde está o erro, por meio do debug (/debugscript 3). Certifique-se de ter verificado o debug. Diga o trecho que não está funcionando caso saiba. Além disso, poste um trecho do código para nos ajudar. E informe o que o script deve fazer para ajudar as pessoas que responderem. Não espere que as pessoas deduzam sem ter informações necessárias! Consulte pelo fórum algo relacionado ao seu problema antes de criar um tópico Uma boa ferramenta é a barra de pesquisa, você pode pesquisar por palavras-chave relacionadas ao que você procura. Isso evitará que vários tópicos similares sejam criados ao longo do tempo. Não peça scripts prontos nem para que façam um script para você* A menos que você esteja procurando por um resource existente. MAS, tenha em mente que este local é exclusivo para ajuda com scripting. Outra exceção, é se você estiver disposto a pagar por um recurso. Por favor postar aqui se você quer pagar por um serviço. * É importante entender como um bom conselho; pedir algo pronto, de fato, nunca vai te ajudar a se desenvolver, além disso, não espere obter suporte para resources vazados na internet e nem ajuda com códigos da mesma origem. Na realidade, é mais benéfico se esforçar em aprender do que pedir pronto, por isso, saiba utilizar este local de ajuda e não apenas para conseguir códigos prontos. Se você já criou um tópico e ele não foi resolvido, não crie outro igual Em vez disso, você pode repostar no seu tópico anterior. Você também pode reviver outros tópicos que tenham o mesmo problema que o seu, mas lembre-se de fornecer informações necessárias pertinentes ao seu problema. Não se esqueça de postar o seu código com a devida formatação (botão Code) : Por fim, lembre-se de definir a linguagem ao qual seu código pertence:
    1 point
×
×
  • Create New...