| Blockland Forums > Modification Help |
| How to make a melee weapon push a vehicle. |
| << < (2/6) > >> |
| Lugnut:
well you showed him what a package is and you somehow told it to add velocity to the golf club not the vehicle? at least you used [tt] package GolfClub { function golfClubProjectile::onHit(%this, %obj, //Other variables, someone fill this in { //Vector code goes here, but I'm not good at maffs, someone help here too parent::onHit(%this, %obj, other variables); } }; activatePackage(GolfClub); |
| Treynolds416:
--- Quote from: Lugnut1206 on June 10, 2012, 07:55:55 AM ---well you showed him what a package is and you somehow told it to add velocity to the golf club not the vehicle? at least you used [tt] --- End quote --- Hahaha, made me laugh |
| Port:
It's onCollision, not onHit. |
| ThinkInvisible:
if you want it to work like the hammer, just add velocity to it without much math: randomVehicle.addVelocity("0 0 5"); if you want it to work like clicking the vehicle, it's slightly more complicated. i don't know exactly how to do it but it involves normalizing the player's position relative to the vehicle. try this: %n1 = vectorNorm(vectorSub(player.position, vehicle.position)); vehicle.addVelocity(vectorScale(%n1, [the velocity you want the vehicle to move at])); a good velocity might be around 30 or 40 on a small object if you want it to move in the direction the player is looking (bad idea IMO): vehicle.addVelocity(vectorScale(player.getEyeVector(), [velocity again])); |
| Treynolds416:
--- Quote from: ThinkInvisible on June 10, 2012, 10:03:51 AM ---if you want it to work like the hammer, just add velocity to it without much math: randomVehicle.addVelocity("0 0 5"); if you want it to work like clicking the vehicle, it's slightly more complicated. i don't know exactly how to do it but it involves normalizing the player's position relative to the vehicle. try this: %n1 = vectorNorm(vectorSub(player.position, vehicle.position)); vehicle.addVelocity(vectorScale(%n1, [the velocity you want the vehicle to move at])); a good velocity might be around 30 or 40 on a small object if you want it to move in the direction the player is looking (bad idea IMO): vehicle.addVelocity(vectorScale(player.getEyeVector(), [velocity again])); --- End quote --- First, it's vectorNormalize Second, you don't have the slightest clue what it is or what it does |
| Navigation |
| Message Index |
| Next page |
| Previous page |