I am having problems with ParticleVPlay:
- I have attached a ParticleVPlay to a moving entity. When the entity first begins moving, some of the particles are generated in the top left of the screen and not in the location of my entity. This only happens the first time the entity moves and only for a few particles. The rest of the particles then behave correctly and emit from my entity.
- When the entity is moving, if I rotate it the particles that have already been emitted also move according to the rotation. I have the positionType set to ParticleVPlayBase.Free. This movement is not desired – the emitted particles are supposed to be smoke and need to move independently of my entity after they have been emitted.
- Sometimes the ParticleVPlay component causes my game to crash. When I launch it on the desktop I get the following error:
ASSERT: “i sDouble()” in file ..\..\include\QtQml\5.6.0\QtQml/private/../../../../../src/qml/jsruntime/qv4value_p.h, line 252
E:\Qt\QTPROJECTS\build-Tankz-Desktop_Qt_5_6_0_MinGW_32bit-Debug\debug\Tankz.exe exited with code 3
When I launch it on my phone, it does not crash, but the particles do not start. This error seems to occur most often when I have just updated / changed my code.
I have shown my code below (I have removed parts that I think are not necessary to show the problem)
Thanks in advance for your help guys…
Darren.
import QtQuick 2.0
import Felgo 3.0
import QtMultimedia 5.0 // required for SoundEffect.Infinite enum value for infinite looping
EntityBase {
id: tank
entityId: "tankEntity"
entityType: "playerTankEntity"
width: 90
height: 34
property real turretController: 0 //controls rotation of turret
property point startPoint: Qt.point(0,0) //used for checking distance tank has travelled, to decide when to drop a tank track
property alias body: baseCollider.body
property alias tankBodyPoints: baseImage.imagePoints
// gets accessed to insert the input when touching the HUDController
property alias controller: twoAxisController
readonly property real forwardForce: 8000 * world.pixelsPerMeter
TwoAxisController {id: twoAxisController}
BoxCollider {id: baseCollider}
TexturePackerAnimatedSpriteVPlay {id: baseImage}
TexturePackerAnimatedSpriteVPlay {id: turretImage}
ParticleVPlay {
id: exhaustParticle
z:4000
// Particle location properties
anchors.top: parent.bottom
anchors.topMargin: -18
anchors.right: parent.left
anchors.rightMargin: -20
rotation: 180
duration: ParticleVPlayBase.Infinite
positionType: ParticleVPlayBase.Free
//More exhaust particles are emitted as the tank moves faster
maxParticles: 5 + Math.round(40 * Math.abs(twoAxisController.yAxis))
// particle file
fileName: "../TankExhaustParticle.json"
// start when finished loading
autoStart: true
}
}
import QtQuick 2.0
import Felgo 3.0
import "entities"
Item {
id: level
width: parent.width
height: parent.height
Tank {
id: tankPlayer
objectName: "tankPlayer"
variationType: "tankPlayer"
x: 120
y: 200
rotation: 0
}
}
import QtQuick 2.0
import Felgo 3.0
import "entities"
GameWindow {
id: window
screenWidth: 720
screenHeight: 1280
Rectangle{
width: parent.width
height: parent.height
color: "white"
}
EntityManager {
id: entityManager
entityContainer: level
}
Scene {
id: scene
width: 320
height: 480
scaleMode: "letterbox"
Rectangle {
id: background
width: parent.width //*1.8
height: parent.height //*1.8
color: "white"
anchors.centerIn: parent
}
// use a physics world because we need collision detection
PhysicsWorld {
id: world
updatesPerSecondForPhysics: 60
debugDrawVisible : true
}
Level {
// this gets accessed by its id from JoystickControllerHUD below
id: level
}
focus: true
}
HorizontalAxisController{
id: turretController
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.bottomMargin: 50
// property variant playerTurretController: level.tank_player.getComponent("TurretController")
onPositionChanged: level.tank_player.turretController = turretController.position
}
JoystickControllerHUD {
anchors.bottom: parent.bottom
// the joystick width is the space from the left to the start of the logical scene, so the radius is its half
joystickRadius: 100 //scene.x/2
// this allows setting custom images for the JoystickControllerHUD component
source: "../assets/img/joystick_background.png"
thumbSource: "../assets/img/joystick_thumb.png"
// this is the mapping between the output of the JoystickControllerHUD to the input of the player's TwoAxisController
// this is a performance improvement, to not have to bind every time the position changes
property variant playerTwoxisController: level.tank_player.getComponent("TwoAxisController")
onControllerXPositionChanged: playerTwoxisController.xAxis = controllerXPosition
onControllerYPositionChanged: playerTwoxisController.yAxis = controllerYPosition;
}
}
-
This topic was modified 7 years ago by
darrenbrown50@hotmail.com.