godotengine / godotengine/godot

Using index access on Quaternion type data to get values will result in a parsing error.

Open
#120,318 3 comments 0 reactions 0 assignees View on GitHub
bug confirmed topic:gdscript
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: 4.7-rc2 and earlier versions.

### System information

Godot v4.7.beta (33431363d) - Fedora Linux 44 (Workstation Edition) on Wayland - Wayland display driver, Single-window, 1 monitor - OpenGL 3 (Compatibility) - Mesa Intel(R) HD Graphics 3000 (SNB GT2) - Intel(R) Core(TM) i3-2348M CPU @ 2.30GHz (4 threads) - 15.45 GiB memory - PulseAudio (44100 Hz, Stereo/mono)

### Issue description

Using index access on Quaternion data to get values will cause parsing errors; you can't access the x, y, z, w components of a Quaternion through indexing. However, similar types like Basis, Color, Transform2D, and VectorX can be accessed by index without any issues.

Please check the description in the game engine's documentation.

https://docs.godotengine.org/en/latest/classes/class_quaternion.html#class-quaternion-operator-idx-int

Image

Image

### Steps to reproduce

Write the following statements in the script:

```
var q:Quaternion=Quaternion()
q[0]
```

### Minimal reproduction project (MRP)

[Quaternion.zip](https://github.com/user-attachments/files/28951450/Quaternion.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the minimal reproduction using a typed Quaternion and q[0], then compare its behavior with indexed Basis, Color, Transform2D, and Vector types. Check the Quaternion operator documentation and verify that indexing parses successfully and exposes the x, y, z, and w components.

Written by the indexing model from the issue text.

Assessment

Tech stack
godot
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.