Open TobiasBenz opened 8 years ago
Furthermore if I try to use Damper, Spring etc. which I guess refer to SDL_HapticCondition Lua wants me to specify a direction as well, but as this page documentation (https://wiki.libsdl.org/SDL_HapticCondition) says the direction is currently handled by by condition internals. If I specify the direction as an empty table I get the same error.
(sorry for the slow response, esp. if you already solved this on your own)
It looks like you are providing a HapticDirection to a function (newEffect
) that wants a HapticEffect.
Try wrapping it like ht:newEffect{direction = t}
and see if that gets you closer?
No worries. In the mean time I tried to use LuaJit ffi with SDL2 that works just fine. I will have alook at the binding next week. But as far as I remember I also tried it with ht:newEffect{direction=t} with the same result.
Try this:
local dir = {
type = sdl.hapticDirection.Cartesian, -- or Polar or Spherical,
direction = { 1, 0, 0 }, -- same as 18000, 0, 0 (after normalization)
-- did you mean Polar/Spherical? -> 18000, 0, 0
}
local effect = {
-- haptic effect details...
--example:
type = sdl.hapticType.Constant
length = 1000, -- 1 sec
delay = 500, -- 1/2 sec
button = 1, -- ??? some random button ?
interval = 2000, -- triggerable every 2 seconds
level = 20000, -- ~ 60% ~ medicore effect (-> read as double?)
attackLength = 250, -- 1/4 sec ~ fast attack gain
attackLevel = 15000, -- ~ 50% ~ starting rather strong (-> read as double?)
fadeLength = 500, -- 1/2 sec ~ long fade out
fadeLevel = 1000, -- ~ 3% ~ nearly nothing to experience (-> read as double?)
direction = dir
}
ht:newEffect(effect)
Hi everyone,
I am on Ubuntu and trying to get a haptic effect with a Microsoft Sidewinder 2. Everything is fine for most of the effects. I get the rumbleEffect and also the LeftRightEffect runing. But as it comes to e.g. the constant effect I seem to be to stupid. I don't manage to specify the effect for a newEffect creation. I always get an error that the direction must be a table. Could some one provide me an example code for an effect definiton?
Thank you so much and sorry for the stupid question,
Tobi
P.S.: My code:
t = {type = SDL.hapticDirection.Cartesian,direction= {18000, 0, 0}} local id, err = ht:newEffect(t) That gives me this error: German: "Speicherzugriffsfehler (Speicherabzug geschrieben)" I think the translation is something like "Memory access error (Core dump written)"