Questions tagged [qvector3d]

The QVector3D class represents a vector or vertex in 3D space. Vectors are one of the main building blocks of 3D representation and drawing. They consist of three coordinates, traditionally called x, y, and z. The QVector3D class can also be used to represent vertices in 3D space. We therefore do not need to provide a separate vertex class.

22 questions
3
votes
2 answers

Calculate bounds of a box including rotation

I am working on collision system for my game that uses custom colliders. I used this to create bounding box for collisions. I am getting problem for the boxes where right and forward values have been used to create box. Otherwise its working fine.…
bhupinder
  • 315
  • 1
  • 6
  • 23
2
votes
1 answer

Draw points in OpenGL with QVector3D

I have a list of QVector3D, which is a list of points, I want to draw a list of points with glDrawArrays. initializeGLFunctions(); glGenBuffers(2, vbo); //the vertices QVector3D *vertices = &data[0]; glBindBuffer(GL_ARRAY_BUFFER,…
tintin
  • 1,459
  • 1
  • 10
  • 27
1
vote
1 answer

(Unity) How does vector multiplication and position updates work in unity?

This piece of code involves the multiplication of a Vector3 moveVector with a float moveSpeed and another float, Time.deltaTime. do these floats get multiplied to every value of the Vector3 (x, y, z)? Furthermore, if I write transform.position…
Wonjae Oh
  • 33
  • 7
1
vote
1 answer

Vector3 MoveTowards does not do the job?

I am trying to move four objects and a SteamVR player by updating the transform.position. This works fine, however it does not look so well because the movement is like instant. That is why I want to use Vector3.MoveTowards(). Somehow, the code…
zerk
  • 516
  • 4
  • 9
  • 34
1
vote
1 answer

How can I move my object based on my axis direction at all times?

I'm trying to move my ball to a fixed distance. For that I used some Vector3 and Lerping. But when when my object rotates, the ball still move in the same direction and not in the new direction set by my X axis direction. I have added more details…
Tim Soph
  • 35
  • 6
1
vote
2 answers

What is correct way to convert QGyroscopeReading to QVector3D?

Is there a correct/good way to convert QGyroscopeReading to QVector3D in Qt5? QGyroscopeReading has its x,y and z values stored as qreal, while QVector3D uses float. Since qreal is not guaranteed to be float (it's type is specified at Qt build…
Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
1
vote
0 answers

How to use Qt's QVector3D::unproject() function?

I'm doing an opengl project in Qt with the new QOpenGLWidget class. I'm just trying to get the opengl world coordinates of my mouse when I click. I've found a lot of ways to do it but some were obsolete and the others don't work. Then I found the…
Alkoou
  • 11
  • 2
1
vote
2 answers

How to display QVector3D in one cell in QTableView via qAbstractTableModel's subclass

I'd like to display QVector3D in tableView, preferably like this: (x,y,z). I had subclassed the QAbstractTableModel class and implemented QAbstractTableModelSublass::data function: QVariant data(const QModelIndex &index, int role= Qt::DisplayRole)…
dodol
  • 1,073
  • 2
  • 16
  • 33
0
votes
0 answers

How to stop body from rotating around wrong axis in unity

I recently started on unity and I wanted to make simple movement which can be seen below. using System.Collections.Generic; using UnityEngine; public class movement : MonoBehaviour { //Variables float speed = 5.0f; public float…
JardexX
  • 3
  • 2
0
votes
2 answers

How can I fix my characters movement speed

I'm trying to make my first game, but I have a problem with the speed control: Whenever I hold down on the button, everything slows down. I'm using time.deltatime which I know is global but I can't find any fixes. void Start () { self =…
0
votes
1 answer

Vector3 is being reset to 0,0,0 Unity

I'm making a game right now where the enemies become alerted to the player and chase them indefinetely until the player stand on a "safe plate" in game. When the player stands here the enemies should then return to their original position. The issue…
0
votes
1 answer

An object was hit by a beam - unity

I have this code for a laser, I want to load a new scene when the laser is touching the player. this script does not work, I'll happy for your help! :) void Update() { Vector3 Point = transform.position + transform.forward * Dis; …
noa
  • 1
  • 4
0
votes
1 answer

Placing labels evenly along curved 3D mesh

I have a single mesh game object that is essentially a long line that curves and slopes up/down. What I'm trying to do is generate some text along this line at a specified distance interval. Let's say every 100 units along the line some text should…
pfinferno
  • 1,779
  • 3
  • 34
  • 62
0
votes
1 answer

Angle between vectors 360 degrees

I want to calculate the angle between a vector3d and other vectors3d in 360 degrees I have tried this with vector3d.AngleBetween but this gives results in 180 degrees //Create a new 3d vector from average points Vector3D vector1 = new…
vanlion
  • 111
  • 8
0
votes
1 answer

Place object without overlap others

Im having a problem in one of my projects in unity. I basicly have a system where you click an object and then you click somewhere inside an area and the object goes to that position. the problem is that those objects can't overlap. And they can't…
André Marques
  • 180
  • 1
  • 15
1
2