Ok, so I’m making a top down shooter with a friend, and I made a test to see if Blender can do what we want. I made a box move around with controls, a working HUD test, an enemy that follows you when you get near and shoots bullets at you, 2 guns that you can select, and some light tests. This all went perfectly and we had no problems.
“Ok, now make a test with walls and textures.”
“Sure.”
I try make the walls one object, and press P. The collision is in only one spot. I try using the different collision shapes, and I either fly away, slide away, or nothing happens. Then I tried making walls with blocks. This worked well, except for the fact that in corners I could launch myself through the little cracks. The radius of these blocks were 0.90, and if they were higher, they would fly away. Then I tried making each side a different object. That worked simply horribly.
The wall should be a static object. The best method is to make an invisible low poly collision mesh and then have your visible walls follow the same shape but be higher detail and set to ghost
But isn’t that still going to cause those problems? Like the flying away, or going through the cracks? Currently, I do not care about how detailed the walls are, I just want to get them working.
As long as the walls are static, the problems must be with your character movement.
Are you using force, servo, or DLoc motion? DLoc is not compatible with the physics engine, as instead of moving the object toward the location, it “teleports” it. If there’s a collision, it’s as if it just materialized inside whatever it collided with, so it goes flying out in unexpected ways.
I see. So, is there some special button that makes an object static? Also, is servo linV? Is there any way to make the movements sudden like dLoc, but using a different kind of movement, and make sure the speed is pretty much as fast as dLoc 0.20? If not, I guess I’ll just stick with the slidy movement.
above where you were setting bounds, you see dynamic, rigid or whatever. change that to static.
Servo motion is acceleration with a maximum speed. It can be found by changing ‘simple motion’ to ‘servo motion’ in your motion actuator. It gives you a lot of control over your movement. (Note that you usually need numbers like 10 to 100 instead of 0 to 1 for ideal speeds with servos)
Servos can be used for both acceleration and deceleration, and can cause very close to instant start/stop if you want them to. There’s a good tutorial on servo motion somewhere, but I’m too lazy to find it at the moment ;/
i have run into literally the same problem, yet there doesn’t seem to be a solution. ive tried several different methods, but no success.
if you use the force motion you will have a physically affected motion, but it takes a while to accelerate and decelerate depending on speed. you can toy around with the force variables and the DYN/friction but i didnt find much success. i just started getting really pissed off.
also with linV, you will move similiarly to the force motion, but i found that my freelook script wasnt as effective.
its amazing that no one else has ran into this kind of problem…
it just makes me feel like a noob.
here i am thinking i was getting good with blender…
WRONG.
I looked at the dynamic and rigid body place, but found no static. :\
Then I also looked at my motion actuators, no simple motion or servo motion. I tried using linV for the movement and it worked quite well, but I had a problem. I can’t go diagonally. That makes the game kind of hard to play. I was thinking of making another 2 keyboard actuators and then making those both connected to an OR, and making a motion which has both linV for the side movement and for the forward/backward movement, but I think that the other normal keyboard sensors would still be activated. That means that when I go diagonally, either my side movement or forward/backward movement will be faster, which will feel unnatural and could be used to cheat.
I’m pretty sure at this point that you’re using an old version of blender. If you have to keep whatever version you’re using for compatibility, you’re pretty much stuck with using python and force/applyImpulse() for proper movement- In the pre-2.48 versions, and arguable still, there is no way to get good movement with just bricks.
c=GameLogic.getCurrentController()
ob=c.getOwner()
#UA = up arrow, DA = down arrow#
UA=c.getSensor("walk_key")
DA=c.getSensor("RK")
#NW = ray sensor on axis that you walk on, detects the wall#
NW=c.getSensor("walk_detect")
#Mo = motion actuator used#
Mo=c.getActuator("Motion")
#Walk#
if UA.isPositive() or DA.isPositive():
if UA.isPositive() and not NW.isPositive():
Mo.setDLoc(0,0.1,0,True)
GameLogic.addActiveActuator(Mo, True)
if DA.isPositive():
Mo.setDLoc(0,-0.05,0,True)
GameLogic.addActiveActuator(Mo, True)
if NW.isPositive() and UA.isPositive():
Mo.setDLoc(0,0.02,0,True)
if NW.isPositive() and DA.isPositive():
Mo.setDLoc(0,-0.02,0,True)
This code assumes you use two keys to walk foward and backwards and arrow keys to turn. I use this code in my maze game and even when using DLoc, I can’t get the player to go through the walls even if I tried. The trick is really slowing down the DLoc movement when walking against a wall, there’s no ray sensor pointing backwards, but the reverse is slow enough to not go through a wall. If you use the left and right arrow keys you should have ray sensors to detect the wall then, just use 4 ray sensors and expand the code if needed.
Ok, I downloaded the new version and everything works great. I changed the movement and I’ll check later if I can go through the walls. Though, now I need some help with sound. Whenever I press P, a gunshot sound plays even though it’s supposed to be only played when the property Pistol is true and when space is pressed. Then when I do press space, the pistol sound plays but also the machine gun sound (for half a second), but only once. From then on it works normally. Any obvious reason this might be happening? I’ll keep looking at it.
try the dampening near the actor buttons, and then play with force, i find with a high dampening and high force the character stops and starts quickly. Directed at cerwinthedoc