I’m currently using Blender for some quick prototyping on my games design degree. I haven’t really delved into the python side of things before but it looks pretty straightforward.
I’m using the mouselook system that can be found here:
Quite simply the system uses applyMovement to give the camera the movement. I would like to use applyForce (it suits my purposes better) but switching ‘applyMovement’ with ‘applyForce’ doesn’t work though from what I see it should.
If anyone has any pointers it would be greatly appreciated
Yeah I’m pretty sure I want to use force - the game is third-person and underwater so the sudden start and stop feels unnatural.
I have made the gameObject dynamic in the logic panel if that’s what you mean. If it needs to be specifically referenced in the python how do I do this?
Also here is the snippet of code that I’m trying to change:
# These two are different, because the motion
# they are applying is global.
if rise:
own.applyMovement([0.0, 0.0, SPEED], 0)
if sink:
own.applyMovement([0.0, 0.0, -SPEED], 0)
movement = [X, Y, Z]
own.applyMovement(movement, 1)
# Dampening Velocity
from Mathutils import Vector
velocity = Vector(object.getLinearVelocity())
if (you want the object to stop but not instantly):
velocity = velocity / 1.1
object.setLinearVelocity(velocity, 0)
You would place these examples after you have applied your force.
As for your problem you need to set the camera to be dynamic in the logic panel. If you have it as dynamic it will be effected by gravity. One it is dynamic the applyForce will work for it.